Issue in setting unique ID in Domino designer

雨燕双飞 提交于 2019-12-11 10:37:38

问题


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
);

回答1:


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"




回答2:


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:


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:


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.



来源:https://stackoverflow.com/questions/28069239/issue-in-setting-unique-id-in-domino-designer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!