Domino Code Fragment

Code Name*
12-digit "unique" number based on date&time
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.135.195.249
Description*
This formula creates a 12-digit document number...
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
REM "This formula creates a 12-digit document number...";
REM "...unique to the second the doc was composed...";
REM "...In my application I call it a Request Number..."
REM "...This is independent of environment, i.e. user...";
REM "...This no. is guaranteed to be unique regardless...";
REM "... of who composed the doc or what view they...";
REM "...were in because it does not use Environment...";
REM "...It also guarantees that each time a doc is composed...";
REM "...the Request Number assigned to it is greater...";
REM "...than that of any previously-composed doc...";
REM "...and less than any subsequently-composed doc...";
REM "...because it is a time stamp. This is useful and...";
REM "...intuitive because Request Numbers are...";
REM "...monotonically increasing. They also capture...";
REM "...both the date the document was composed...";
REM "...and the order in which the docs were added...";
REM "Request number is a unique, 12 digit number...";
REM "...composed of yr + mo + dy + hr + min + sec.";
REM "...where two digits are used for each part...";
REM "..This formula goes to great pains to ensure...";
REM "...that each 2-digit part occupies exactly 2 digits...";
REM "...so that, e.g., digits 5 & 6 always encode the day.";
TimeNow := @Now;
YearString := @Right(@Text(@Year(TimeNow)); 2);
MonthString := @Select(@Month(TimeNow); "01"; "02"; "03"; "04"; "05"; "06"; "07"; "08"; "09"; "10"; "11"; "12");
DayNumber := @Day(TimeNow);
DayString := @Select(DayNumber; "01"; "02"; "03"; "04"; "05"; "06"; "07"; "08"; "09"; @Text(DayNumber));
HourNumber := @Hour(TimeNow);
HourString := @If(HourNumber = 0; "00"; @Select(HourNumber; "01"; "02"; "03"; "04"; "05"; "06"; "07"; "08"; "09"; @Text(HourNumber)));
MinuteNumber := @Minute(TimeNow);
MinuteString := @If(MinuteNumber = 0; "00"; @Select(MinuteNumber; "01"; "02"; "03"; "04"; "05"; "06"; "07"; "08"; "09"; @Text(MinuteNumber)));
SecondNumber := @Second(TimeNow);
SecondString := @If(SecondNumber = 0; "00"; @Select(SecondNumber; "01"; "02"; "03"; "04"; "05"; "06"; "07"; "08"; "09"; @Text(SecondNumber)));
@TextToNumber(YearString + MonthString + DayString + HourString + MinuteString + SecondString)