This is a useful reminder that Apply to each isn't always the best default choice. It's easy to fall into the habit of looping over every collection, even when you only need a specific value.
Using XPath for targeted XML queries can make a flow easier to read and may reduce unnecessary processing, especially when dealing with larger payloads. That said, I think maintainability is also worth considering. Team members who are less familiar with XPath expressions may find a simple loop easier to understand at first.
A practical approach is to use XPath when you're extracting well-defined values from XML, and reserve Apply to each for cases where you genuinely need to perform actions on every item. Balancing performance with readability usually leads to the most maintainable flows.
This is a useful reminder that Apply to each isn't always the best default choice. It's easy to fall into the habit of looping over every collection, even when you only need a specific value.
Using XPath for targeted XML queries can make a flow easier to read and may reduce unnecessary processing, especially when dealing with larger payloads. That said, I think maintainability is also worth considering. Team members who are less familiar with XPath expressions may find a simple loop easier to understand at first.
A practical approach is to use XPath when you're extracting well-defined values from XML, and reserve Apply to each for cases where you genuinely need to perform actions on every item. Balancing performance with readability usually leads to the most maintainable flows.