I built this functionality today for a client, it seemed very share-worthy, especially since I wasn’t quite sure it would work until after I built it.
There have been many posts about how to setup looping actions and how to automatically generate a number of new records. If you haven’t read those threads, you should start with those before reading this one. I may or may not come back to edit this post to link some of those other threads. Well here is one at least, since the community is trying to tell me my “topic is similar to…” :
[Looping with actions](https://community.appsheet.com/t/looping-with-actions/25379) Tips & Tricks ?
Kinda burnt out and just wanna get this out. I’ll try to circle back later and provide some documentation. https://www.appsheet.com/samples/Examples-of-loops-using-actions?appGuidString=7b9ae746-1f51-4ecb-8c39-b322e1c12da6
This is an even more advanced setup, where there is a loop within a loop.
The functionality is built to allow employees to request certain shifts across certain dates. We wanted the app users to be able to quickly select multiple shifts and multiple dates, so I setup two EnumLists for them to select multiple from, inside a single record.
HOWEVER
For the schedulers to do their job, and be assisted by some app automation, it is much easier/better to see individual records linking each single shift to each single date. So what I wanted to do here is to create all combinations of shifts versus dates from these two EnumLists.
As you can hopefully already tell, we can’t just loop across one EnumList and create the records, we need to have an inner loop to loop across the 2nd EnumList within the loop for the first EnumList.
The general overview strategy here is:
1. Outer loop
A. Re-calculate COUNT for inner loop
B. Execute inner loop
i.Inner loop
a. Create a new record
b. Decrement inner loop count
c. Re-loop inner loop (IF count > 0 )
C. Decrement outer loop count
D. Re-loop outer loop (IF count > 0 )
And here is a general overview screenshot of the set of actions:
*Extra bonus tip here too, you get to see the naming schema that I use when creating large grouped action sets.*
This entire Action group is set as the Form Saved Behavior for the shift_request_input Form view. I might move it to be executed via Bot so that the users don’t have to potentially sync dozens of records on their end, but I haven’t gotten that far yet.
* [employee_month] is just a Ref column to a parent record. *


