1
votes

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
Hi - where does that error occor ? And when - is it when creating a new document or opening an existing one ?user2808054
It comes when I'm starting IBM notes(preview ) @user2808054 I can't even open the previewtheRoot
Bad formula. 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. @DbColumn("" : "NoCache"; "":"DBintro";"testview"; 1);David Navarre

4 Answers

2
votes

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

1
votes

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.

1
votes

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

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.