Domino Code Fragment

Code Name*
Creating an Edit History 1-99 edits
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.191.211.66
Description*
This formula compiles a list of edits that can be adjusted from 1-99 edits. This formula is from the Advanced App Dev courseware in the Appendix "Tips and Tricks" page 189. Create a computed, text field called "SaveHistory".
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
REM "ListSize contains the number of document saves that will be shown in the document";
ListSize := 5;
REM "See if the document is being saved. If not, exit without change.";
@If(IsDocBeingSaved; @True; @Return(SaveHistory));
EditList := SaveHistory;
REM "Document is being saved. Determine the number of the prior save.";
REM "For example, if A is 6, that indicates the document has been saved 6 times and this current save will be the seventh.";

A := @Word(EditList; "-"; 1);
REM "Calculate the current save number, taking into account the number 1-9 are only one character long.";
NEWNUM := @Text(@TextToNumber("0" + @Word(@Implode(A); " "; 1)) + 1);


REM "Build the new edit line(format the date correctly)";
REM "Notice the second parameter on the @Text function. This seldom used";
REM "parameter allows us to automatically format a date/time argument";
REM "In this case, it strips off the seconds from @Now.";

NEWLINE := NEWNUM + "-" + @Text(@Now; "D0T1") + "-" + @UserName;
@Trim(@Subset(NEWLINE : EditList; ListSize))