Forum Discussion
Flow attaching apply to each inside apply to each
Hi Cdstrev,
solution is to use the Filter array action to filter the Services dynamic content to only include the services specified in the If condition, and then iterate over the filtered array using the Apply to each action.
Here is an example flow:
Trigger: When a new response is submitted in Microsoft Forms
Actions:
1. Get form response details
2. Filter array (value: Services, filter condition: equals, value: 9)
3. Apply to each (items: filtered services):
* Do something with the current service
4. End of flowHere are some links for reference:
- Power Automate Filter array action: https://sharepains.com/2018/12/18/filter-an-array-power-automate/
- CdstrevOct 10, 2023Copper Contributor
Thank you for your response. Could you please assist me with where the filter array would go?
- LeonPavesicOct 12, 2023Silver Contributor
Hi Cdstrev,
thanks for your screenshot and your update.To add a filter array action to your flow in the image you provided, follow these steps:
- Click the Add an action button and select Data operations.
- Select the Filter array action.
- In the Value field, select the Services dynamic content.
- In the Filter condition field, select the equals operator and enter the value of the service you want to filter.
- Click the Add new item button to add additional filter conditions, if needed.
- Click the Save button.
Once you have added the filter array action, you can connect it to the Apply to each action. To do this, click the Select output from previous steps button and select the Filtered services dynamic content.
You can place the filter array action before or after the condition action, but it is generally best to place it before the condition action so that you are only filtering the services that are relevant to the condition.Here is an example of how to place the filter array action before the condition action:
Trigger: When a new response is submitted in Microsoft Forms Actions: 1. Filter array (value: Services, filter condition: equals, value: 9) 2. Condition (condition: Service equals 9) * Yes: Do something with the service * No: Do something else 3. End of flowThis flow will only iterate over the services that match the filter condition (Service equals 9). If the service does not match the filter condition, then the flow will skip the Do something with the service action and go straight to the End of flow action.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)