Domino Code Fragment

Code Name*
Get the Previous Month
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.145.156.46
Description*
The following routine will determine what the previous month is following the month curently being displayed. If the previous month is January, then the routine will subtact one to lower the year.
Type*
Formula
Categories*
Date/Time Handling
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
REM "Build string of month numbers and month names";
M_DEX := "01" : "02" : "03" : "04" : "05" : "06" : "07" : "08" : "09" : "10" : "11" : "12";
M_MENU := @UpperCase("January" : "February" : "March" : "April" : "May" : "June" : "July" : "August" : "September" : "October" : "November" : "December");


REM "Convert Month field from text to number";
mth := @Replace(@Text(Month); m_menu ; @Text(@TextToNumber(M_DEX)));


REM "Subtract one from the numeric month field. Also change the year if needed.";
REM "If new value is 13 then set to 01";
NU_MONTH := @Replace(@Right("0" + @Text(@TextToNumber(Mth) - 1); 2); "00"; "12");
NU_YEAR := @Text(@TextToNumber(Year) - (NU_MONTH = "12"));

REM "Get new Month text value";
x := @Replace(@Text(nu_month); @Text((M_DEX)); M_MENU);


REM "Update the month and year fields in the current form";
FIELD Month := x;
FIELD Year := Nu_Year;


REM "Force the current form to be refreshed";
@Command([ViewRefreshFields])