Issue in setting unique ID in Domino designer

2019-08-15 01:53发布

I am new to Domino designer and lotus script,

following my second question,

I have some issue in setting unique ID (for id field in form).

My formula for Id field value :

T_List:=@DbColumn("" : "NoCache"; "Local"; "DBintro";"testview"; 1); @If(@IsNewDoc & @Elements(T_List)=0;1;@IsNewDoc & !@IsError(T_List);@Subset(T_List;1) + 1;id)

I'm having DB in local (nothing shared).

referred this link an Answer by AndrewB

Server : Local

DBname : DBintro

view name : testview id - field in the form (which is set when required to save in DB)

Error I'm getting

Field id ! does not exist

Please help me to get out of this.. Thanks

EDIT :1 Updated code

T_List:=@DbColumn("" : "NoCache"; "Local"; "DBintro";"testview"; 1);
T_List:=@Sort(T_List; [DESCENDING]);
@if(@Iserror(T_List);
  1;
  @Subset(T_List;1)+1
);

4条回答
The star\"
2楼-- · 2019-08-15 02:29

Perhaps re-arranging the logic might help - try this in the formula for Id field. Make the field "Computed When Composed" (next to field typer in properties box - it means it only evaluates when the doc is first created, and remains the same after - saves detecting @IsNewDoc :-D ):

T_List:=@DbColumn("" : "NoCache"; "Local"; "DBintro";"testview"; 1);
@if(@Iserror(T_List);
  1;
  @Subset(T_List;1)
);

You don't have to worry about the id field returning itself if the doc isn't new, because the computed when composed field stops evaluating after 1st save.

查看更多
冷血范
3楼-- · 2019-08-15 02:34

Bad formula for your dbColumn. There should be a colon, not semi-colon between servername and filename. Of course, there is no server named "Local". You would just use "" for local. Also, the filename is the full filename - "DBintro.nsf", not "DBintro".

T_List:=@DbColumn("Notes":"NoCache"; "":"DBintro.nsf";"testview"; 1);
T_List:=@Sort(T_List; [DESCENDING]);
@if(@Iserror(T_List);
  1;
  @Subset(T_List;1)+1
);
查看更多
祖国的老花朵
4楼-- · 2019-08-15 02:35

Have you got the unique ID set as a text field because I have found that the formula has to be converted to a text value and not just the unique document id.

查看更多
贼婆χ
5楼-- · 2019-08-15 02:38

Set type of field "testid" to "Number"
Change formula to

_List:=@DbColumn("" : "NoCache"; ""; "testview"; 1);
@If(    @IsError(_List);
            1;
        _List = "";
            1;
            @Subset(_List; 1) + 1
)

Set column sort to "Descending"

enter image description here

查看更多
登录 后发表回答