Using a counter in loop that reopens previous tasks and resets dependent tasks
I am unable to determine how to properly setup a loop that has a counter in it. I used the help article here:https://help.catalytic.com/docs/pushbot-reopen-task-and-reset-dependent-tasks/, but still no luck. No matter what I do the defined "counter" variable never increases beyond zero. What am I doing wrong?
Best Answer
-
@Greg_703914 - a few things:
1. Instead of using 'Set value of an integer field' action type to initially set the value to 0, I would recommend using the action type Numbers: Perform basic math to set the initial value to 1 or 0 (first time running through the process). Part of the reason is that the field reference is{{counter--Output}}
for the Numbers: Perform basic math action so incorporating that output field earlier is better as you add the loop.- In your Count number of tabs extracted step, you'll use
{{counter--Output}}+1
for the Calculation field. You'll also want to remove the handlebar reference from the Output field prefix config field. This should only becounter
. Output fields should not have handlebars included as these fields generate the fields that can be referenced via handlebars.
1 - In your Count number of tabs extracted step, you'll use
Answers
-
@Meghan_160385 that worked perfectly! I can't tell you how happy I am to see this work as it was intended. The help guide I mentioned above tells the builder to use the integer: set an integer value and isn't clear on the defining the output variables or setting the conditions so I wasn't totally clear, but your two corrections made it work so thank you. I think I may not fully understand how the {{counter}} output fields and {{counter--Output}} are working together to increase the value but again thank you! This made my day. I was messing around with this for so long to make it work.
0 -
Great @Greg_703914, glad to hear that and you're welcome! We are going to revisit and modify the Help article for the loop directions based on your experience - so thank you for reporting this!
1