Repeat something n times

Hi there, is there a native capability yet that would allow you to execute a trigger n-times? E.g. to populate an array with some placeholders that the user then completes one after the other…?

In the meantime I have reverted to a custom widget that get’s the job done.

getValue("Count", (i) => {
  if (i)
    for (let ii = 0; ii < i; ii++) {
      fireEvent("Execute", ii);
    }
});

Thanks,
Seb

You can step-loop to repeat a trigger on step enter up to 100 times.

For arrays you can build an empty step → on step enter → if array not blank → pop from array
do what ever you want with your value you popped from the array
→ go to step → itself

If Array is blank → go to step → next or previous or so… just exit the loop

The amount of loop cycles is limited! Don’t use this on to many repetitions

Ok :smiley: Thank you for the workaround suggestions… In this case I will stick to the widget and leave that to a (hopefully) future update :wink:

In case someone is interested… this is what I am using… it has a “Before” and “After” trigger event specified as well. Works.

customWidget-SD Repeater.json (1.4 KB)

Thanks @thorsten.langner and @jmlowden for your input here!! Great options and advice.

From the Tulip side, I think this is something that will be made possibke natively with looping in Automations - that feature is coming very soon (likely in a couple months). I will follow up here once that is released as well :slight_smile:

Hello Beth, i think you are talking about a very different use case here when referring to automations… that is unless there is an intention to make these automations callable from an app directly. But from a structure point of view I am afraid this would become extremely messy quite quickly as you offload/burry pieces of your logic into a different module within the Tulip platform. Maybe just my opinion.

Say I have a form which I know well in advance that I will have to fill in n-observations. I what to give the operator feedback on what is needed, how much, and what he has entered so far.

In this context hardcoding the inputs will not get you the desired outcome. You will need to find a way to pre-populate your placeholder variabel with somethign that can then be augmented by the operator input.

This is where the loop comes into play.

In this particular example where the widget is going to be used:

  1. Clear the object variable and read out the necessary loop count → “Before” trigger
  2. Iterate through the loop and fill the object with the placeholder data
  3. Notify the operator that he is expected to start filling in his observation → optional, just for illustration “After” trigger