Forum Discussion

amardeep2021's avatar
amardeep2021
New Contributor III
4 years ago

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.

10 Replies

    • alchemiz's avatar
      alchemiz
      Contributor III

      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

  • rgoerwit's avatar
    rgoerwit
    New Contributor II

    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.

  • amardeep2021's avatar
    amardeep2021
    New Contributor III

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

    • alchemiz's avatar
      alchemiz
      Contributor III

      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 🙂

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