I have created a simple looping script to create shifts for an employee. The script starts by pulling data from 4 global fields – Week start, Employee ID, Shift ID and Number of days this shift is to repeat itself - see screenshot below:
I use the following tables:
- People_Shifts (Join Table)
- Menu (contains the global fields)
What I'd like to do
I've looked at other non-Filemaker or commercial solutions and I see that these program create records based on selected days - see below:
I'm trying to figure out how to do this in Filemaker.
I can do or know the following:
- Create a value list of days - Mon - Sun
- In know the 'start date' or first date of the weekly shift which is always a Monday - say in this instance, Monday 19th December, 2016
- I can create a field called 'Shift Days' - this is a checkbox field based on the Value List above. This field will contain a comma separated list/array of the days selected - in the above case Mon, Tue and Thu.
- I can count the number of days in the field using ValueCount calculation.
- I can use GetValue to pull out a value in the field
So in summary I have:
The number of records to create via ValueCount
The shift DaysI need to create records (Mon, Tue, Thu) via the checked boxes
The first day of the weekly shift
My Question (I've got to it at last)
How do I create the three records with the correct dates for Mon, Tue and Thur.