I am working on a time card solution for our company, and I want to auto-enter last Monday's date in the Week Starting field. If today is Sunday or Monday, I want it to show last Monday's date. If it is Tuesday or later, I want it to show this Monday's date. Using FMPA 11.
Here's my existing calculaiton:
Let ( [
today = get ( currentdate ) ;
daynum = DayOfWeek (today) ] ;
daynum < 3 ; //if today is Sunday or Monday, go back to previous Monday
today - 5 - daynum;
today + 2 - daynum; //otherwise go back to current Monday
) // end CASE
) // end LET
This works now, but I have a feeling it could be more efficient. Is there a better way to do this?
edit to clean up formatting