I use something similar for a two week timesheet. User selects "Pay Period End" date by clicking in date field and choosing the date for 2nd Sunday from the calendar. System displays that date in form . I then use offsets from that date ( -0 to -13) to populate 14 dates for Days on form.
For each Day date object used, you need to modify calculate::script for destination object name and offset value
Copy the first line below (feel free to include my //comments too) and paste it in the calculate event (FormCalc) for each Day date object.
If user enters date for Monday then date object offset for Friday would be +4, etc.
OffsetDate1.rawValue = Num2Date(Date2Num(StartEndDate.formattedValue, "DD-MMM-YY") +/-zz, "DD-MMM-YY" )
//Usage: Autofill Date objects on form when user enters a date.
//Language:FormCalc; Event:Calculate; Date object:Calculated - Read Only; Data Pattern binding:"DD-MMM-YY"
// Method:Cast user entered date as number,add offset,re-cast number as date,assign value to date object.
//DayObjectName.unformatted = makeDateFrom#(make#fromDate objectname.formatted(date, “source date format") +- offset, "dest object date format")
// </Pseudo code>
//OffsetDate1 is object name for Day receiving the date: StartEndDate is the date entered by user.
// +/-zz is # days before(-)or after(+)the start/end date
//binding of date object can be modified but the “Data Pattern” used MUST be defined in your script
HINT: Format one date object with script and binding then drag it to Favorites Library as a date/time object called FVDT (or PVDT) so it can be reused. Hope this helps Ed McGrath C.E.T.
Message was edited by: Ed McGrath