Domino Code Fragment

Code Name*
Assign Next Consecutive Number (Uses Environment Variable)
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.217.182.45
Description*
In the default value of a field, use this formula to assign the next consecutive number using an environment variable:
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
REM "Retrieve last number from the Environment variable";
Temp := @Environment("Num");
REM "Start with zero if the Environment variable came back blank";
Temp2 := @If(Temp = ""; "00000"; Temp);
REM "Change to numeric";
CurrentNum := @TextToNumber(Temp2);
REM "Add one to get the next number";
NextNum := CurrentNum + 1;
REM "Calculate number of zeroes you need to pad with to get a five-digit number";
Zeroes := (NextNum < 10000) + (NextNum < 1000) + (NextNum < 100) + (NextNum < 10);
REM "Assign and save the number - converting it back to text";
ENVIRONMENT Num := @Repeat("0"; Zeroes) + @Text(NextNum);
REM "Return the new number as a text string";
Num