I have a requirement for automatically creating multiple items in a target list, whereby the number of items to be created and their contents are driven by a source list, sort of transpose and expand.
|Data in Source||Q1||Q2||Q3||Q4|
|Result in Target|
In a nutshell, for each item in the source list, create as many items in the target list as specified in each column.
If column Q2 for item A is 2.5, I need 3 items in the target list, 2 with a value of 1 and the 3rd with a value of 0.5.
I figured out the innermost part by setting a variable, then a do until loop variable <= 0 with the output formula
and then decrement the variable by 1.
That works just fine, but now I need to assure that new items are only created for the item that was modified in the source list and triggered the flow. I applied an array filter after the Get items action, tried comparing both, Title and Title Id from "when an item is created or modified" with Title resp. Title Id from the Get items array, but to no avail, the workflow completes with no error but creates the new records for both, row A and row B in the source list, no matter which one I modify to trigger the flow.
Any suggestion? Thank you!
No way to get this to work, Apply for each affected all records from Get items.
Instead, added another condition within the Apply for each section:
So this does the trick just fine, but not very elegantly. What could be wrong with my Filter Array?
Do you want to create new item within the target list for an existing item is modified within your Source list?
Could you please share a screenshot of your flow's configuration?
If you could provide more details about your scenario, we would provide a proper workaround for you.
Yes I want to create multiple items in the target list, based on data in source list items, but it's actually triggered when an item is changed in a third list which has a key to items in the source list.
So when an item in the triggering list is modified, the flow should make a collection of all matching entries in the source list and then create items in the target list. I figured out the workaround, using another condition within the Apply to each loop, but that's not very elegant, as it will cycle through all items in the source list skipping those that don't match the key from the triggering list.
Here the screenshots:
If Status equals approved, get items from the Source list and filter the array for items where the title matches the key from the triggering list stored in thisPlanTitle:
And that's where it fails. The subsequent Apply to each loop will act upon all items in the source list, not only those where the title matches the key from the triggering list.
Here the workaround: adding a condition within the apply to each section
I then thought well, of course the Filter Array must be within the Apply to each section in order to work!
But no, that makes of course no sense and didn't solve my issue. So I'm going to keep the Condition within the Apply to each cycle, as long as there are not hundreds or thousands of items it won't matter much, but still I would like to understand why Filter Array after Get Items is not filtering the items correctly.
We are excited to announce the launch of Power Virtual Agents Community. Check it out now!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!