Hi,
I’m having trouble using backend workflows to create a loop that runs through a list of files and adds them to the database.
Basic UI for the upload page
I have a multi-upload box where I upload several files to. From here I click the “Save Uploaded Files” button which calls a backend workflow called “Upload”. This workflow takes in 3 values:
- UploadedFiles - List of files (The files in the multi-upload box)
- Iteration - Number (A variable to loop through the list of files)
- Count - Number (The number of files in the multi-upload box)
Calling the backend worflow
The backend workflow settings
The backend workflow then creates the shows using ‘item# iteration’
Creating a database entry using the backend workflow
Before then calling itself again and adding 1 to the “Iteration” variable. This should only occur when iteration is less than count.
Looping the workflow
However this is not quite outputting the correct result. For example, when uploading 2 files instead of just adding 2 files it duplicates the second.
With three uploaded files it goes even more nuts:
I’ve spent too long trying to figure this out and fear its something very simple that I’m missing. Any pointers would be greatly appreciated.
Thanks.