I need to prompt the user with a Picklist of dates but the dates have to correspond to every Friday in the current month, for example 4/4, 4/11, 4/18 and 4/25. I’ve looked at @Adjust, @Month and @Weekday but I’m not sure how to make it work together. New to Notes development.
Thanks
Subject: Picklist of Fridays in a month
Well, it does take a bit of doing:
startDate := @Adjust(@Today; 0; 1-@Day(@Today); 0; 0; 0; 0);
fridayList := @Adjust(startDate; 0; 0; @Select(@Weekday(startDate); 5; 4; 3; 2; 1; 0; 6); 0; 0; 0);
nextFriday := @Adjust(fridayList; 0; 0; 7; 0; 0; 0);
@While(@Month(nextFriday) = @Month(startDate);
fridayList := fridayList : nextFriday;
nextFriday := @Adjust(nextFriday; 0; 0; 7; 0; 0; 0));
@Text(fridayList)
That starts by finding the first day of the current month – a handy formula in a lot of circumstances. The next line finds the first Friday of the month and puts it into the list of Fridays. After that, it’s a matter of adjusting ahead a week until you step out of the current month. Because you want to populate a text-type field, a text conversion is done on the list after the list is completed.
NOTE: you are going to want to convert the user’s choice to a proper date to be stored in another field. Text values depend on local machine settings, so what is a meaningful date on one machine will be garbage on another.
Subject: RE: Picklist of Fridays in a month
Wow, thanks for the quick response. I have a lot to learn but this was very helpful and informative. Thanks again