This tip provides a quick way to dynamically number rows. The code helps provide a quick visual item listing for end users when dealing with multi-item lists.
The code will generate a list from 01-99. To increase the row numbering to 999 simply add another permutation and adjust the limit like this:
tNumberList := @Subset (@Subset(tNumberSet *+ tNumberSet * + tNumberSet; -999); tListElements);
Keep in mind that there is a Lotus Notes field limitation that could limit the overall formula computation. If a list grows beyond the Notes limitation, you will see this error: "Paragraph or field cannot be larger than 64K bytes."
REM "This is the field which needs to be enumerated."; tFieldList := ListTX; REM "Build number array"; tListElements := @Elements(tFieldList); tNumberSet := "0":"1":"2":"3":"4":"5":"6":"7":"8":"9"; tNumberList := @Subset(@Subset(tNumberSet * + tNumberSet; - 99); tListElements); tRowNums := @If(tListElements < 1; ""; tNumberList); REM "Concatenate number array with actual text list."; tRowNums + ": " + tFieldList
The value for variable tListElements is assigned by the formula
And because of this, tListElements will NEVER be less than 1, so it is pointless to check for this case. In this case, instead of the last few lines of the code being:
tRowNums := @If(tListElements > 1; ""; tNumberList); REM "Concatenate number array with actual text list."; tRowNums + ": " + tFieldList
I suggest that the code be:
tRowNums := @If(@trim(tFieldList) = ""; ""; tNumberList + ": "); REM "Concatenate number array with actual text list."; tRowNums + tFieldList
This will prevent the return of a ":" when tFieldList is blank
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member John Robertson. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.