Manage Learn to apply best practices and optimize your operations.

Numbering dynamic rows

This tip provides a quick way to dynamically number rows.

View member feedback to this tip.

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

MEMBER FEEDBACK TO THIS TIP

The value for variable tListElements is assigned by the formula

@Elements(tFieldList)
 

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

—Cesar M.

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.

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close