Last week I was reviewing a logic app with one of the lead developers at Theta. It was a relatively simple logic app. It needed to call an oData endpoint on a regular basis, and process the value back. The developer original design was to:
- Poll the oData endpoint on the agreed interval.
- Test if the value array length was bigger then zero
- If the array was larger than zero, process each value in the array within a for each.
- Else, terminate the instance as cancelled, so he could distinguish between real executions and zero-length polls.

That would work, but if felt wrong for a couple of reason.
- The logic app was wasting an action to test if the actual logic would be executed or not.
- Another action was being wasted just to tag the logic apps that didn’t actually “fired”.
Then it dawn on me that we should be using splitOn instead. This would avoid the check, Setting up the splitOn is as simple as adding this on your trigger:
"splitOn": "#splitOn-expression#",
Continue reading “Using splitOn in a trigger to avoid zero length executions”