How to implement looping logic in snaplogic?

I have a scenario to repeat a specific action if the expression is true. I don’t have a specific control over the number of times that I need to repeat. It has to be till the expression is true. Does anyone knows which snap or approach would be useful to implement this logic? Please help.

Regards,
Amar.

@amardeep2021

Do you want to invoke the pipeline as many times as the expression is true?

Regards,
Spiro Taleski

Yes Spiro.

@amardeep2021

You can use Pipeline Execute Snap.

I am attaching two pipeline skeleton’s for two scenarios:

  1. Using Parent-Child(Invoking Child pipeline)

SC_1_2022_01_24.slp (7.8 KB)

  1. Pipeline Self-Invoking

SC_2_2022_01_24.slp (8.3 KB)

Hope this helps!

Regards,
Spiro Taleski

1 Like

For me SC_1_2022_01_24.slp, when supplied with a valid child pipeline and executed, results in a stack overflow - an infinite loop of some kind. It does that while prepping the pipeline. The child never actually executes as far as I can tell.

Hi Amardeep,

Good day, have you tried setting up using File Poller?

I did create before a PoC pipeline before that is set to ultra task (can’t find the pipeline, but the logic is something like this), hope this helps

Create a trigger file and upload it in the same project folder as the pipeline, the ‘poller.trigger’ file must always exist so that there will be a streaming object to trigger the next snap.

Thanks,
EmEm

Thanks Mike for sharing. Can you please share me the pipeline for reference.?

For your reference hope this helps.

loop.zip (5.0 KB)

FYI, I just set the File poller to loop every 15 secs for the span of 60 seconds… setting this up to -1 and it will never end unless manually terminating the pipeline from the dashboard… removing the poller.trigger file will put the looper pipeline into a stall cause there is no streaming document that will trigger the parent pipeline :slight_smile:

I would suggest to create a scheduled task and run pipeline daily, then put a 24 hours in the polling timeout