Counter not working properly

I made a counter variable to check the number of tasks completed. I declare a counter variable with an initial value 0 on default/variable section (not in any workflow). At the end of the task (after submitted), I added counter = counter + 1 to increase the counter value.
I made a workflow where my workflow would close the tab after the counter (no. of task completed) = 30. I thought the counter will start again from ‘0’ but it’s starting from 30 onwards (31,32,33, and so on). but the problem with that is it’s closing tab and doing whole process again.

my work flow requires - login with pw and username, click some button, type into and select and submit and it goes on loop. Since I need to complete more than 10,000 tasks I have used counter. so that i won’t have any issue with browser.

Hi @Samraat_Maharjan1 ,

I believe you would require to reset the counter value to 0, If the counter hits 30.

The default value will be applied to the variable if the workflow in which it is available invoked each time, once the workflow is invoked, if there are changes made to the value of that variable it will be applied/updated to it until the control is moved out of that workflow.

I have initialized the Counter variable below where in the default value I have kept 0. So, do I need to assign another counter = 0 variable at the top?
I have used the close tab to close the process/workflow and start again. Will Kill browser help me in this case?

@Samraat_Maharjan1 ,

Does this mean you are invoking the whole workflow again or does it mean that you are just closing the Browser Tab and the control is still in that workflow and it is a just a different loop within the workflow itself ?

@Samraat_Maharjan1 ,

Maybe for a Better understanding, you can check the below Implementation :

  1. Consider the below as Workflow_1. It has a variable counter initialised with value 0. In the workflow, I am adding 10 to it and updating the value. So when executed it will have 0 at the beginning and then update to 10 at the end.

  2. Now when I invoke this workflow more than once, whenever the execution moves into the Workflow_1, it is reseted to the Default Value i., 0.
    image

So the Output would be like below :
image

From the above, you could observe whenever the workflow is invoked (marked by Iteration Count), the counter is resetted to 0 each time (Marked by Before Update).

Thank you. I got it, mate.

1 Like