Process fallback route only once

Hi everyone,

Is there a way to process a fallback route only once, regardless of the number of bundles? Let’s say you query a database, it returns 10 bundles of data. I have a router followed by a filter. If 0 bundles pass through the filter, I want the fallback to run, but ONLY once, not once for each bundle.

Is this possible?

Thanks!

It is not. 0 bundles means nothing will run past the filter.

You’ll need at least one bundle to run and then the fall back route will need to capture that bundle only.

Sorry, small misunderstanding here.

  • The DB query returns 10 bundles.
  • 0 bundles pass through the filter on route 1.
  • All 10 would pass through the filter on route 2, but I only want that to run once, and only if 0 bundles went through the filter.
  • The data in the bundle is not relevant. It only serves as a trigger.

I solved this by setting the filter on route 2 to have Bundle Order Position | Numerically equivalant to | Total number of bundles. I also had to use a boolean switch stored in a datastore to control the logic, if the top route runs the switch is set to 1, and the bottom route checks the switch, if still 0 it runs, if it’s 1 it doesn’t.

1 Like

Heya @MattFox thanks for the clarification and for sharing your solution to this challenge with the community :pray: I’m sure this will prove super helpful to someone who’s looking for similar answers. Awesome stuff :purple_heart: