How does the condition "execution count" work?

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
User avatar
kintrupf
Posts: 257
Joined: 10 Sep 2013 08:59

How does the condition "execution count" work?

Post by kintrupf » 01 Aug 2014 10:55

The help says "An internal counter is incremented whenever the condition is executed. The counter is reset to zero when to condition is met."
So when I construct a simple loop with an Execution Count condition I would expect that the loop executes exactly count times each time the flow runs, since the internal counter should always reach count and then reset itself for the next time the flow is run.

However, if I set count to 3 the loop often executes only 1 or 2 times. Why?
I've added a very simple example loop:
execution_count_example.xml
(1.42 KiB) Downloaded 337 times
It would be great to use Execution Count for simple loops instead of manually controlling a loop counter with scripts and expressions.
It would then also be nice to be able to initialize count with a variable and also have optionally the Execution Count condition fill a variable with the current count ;)

sambarlick
Posts: 96
Joined: 27 Jul 2014 10:40

Re: How does the condition "execution count" work?

Post by sambarlick » 01 Aug 2014 14:48

I have a similar but opposite issue with the execution count. I am working on a flow that when i get home sends a text to my wife telling her I'm home.

I set the execution count to 1 message per day. This seemed to do nothing as it sent more than one per day.

What are u trying to achieve with the execution count?

Sam

User avatar
kintrupf
Posts: 257
Joined: 10 Sep 2013 08:59

Re: How does the condition "execution count" work?

Post by kintrupf » 01 Aug 2014 20:07

sambarlick wrote:What are u trying to achieve with the execution count?
I would like to use it for simple loops within my flows.
According to the help it should work, but I can't figure out why it does not.

sambarlick
Posts: 96
Joined: 27 Jul 2014 10:40

Re: How does the condition "execution count" work?

Post by sambarlick » 02 Aug 2014 14:00

When i first started using automagic i used sleeps to keep the flows alive, but this caused issues with the flows. I'm not sure if the flows are ment to be kept alive.

I'm also not sure why the execution action doesn't work properly.

Sam

plasticmagnet
Posts: 19
Joined: 14 Sep 2013 18:41

Re: How does the condition "execution count" work?

Post by plasticmagnet » 03 Aug 2014 00:00

Condition works correctly.
For some reason i couldnt attach the file so i used drive.

Example Execution count:
https://docs.google.com/file/d/0B33y-aB ... cslist_api

User avatar
Martin
Posts: 4444
Joined: 09 Nov 2012 14:23

Re: How does the condition "execution count" work?

Post by Martin » 04 Aug 2014 15:59

The condition is false until the execution count is reached, at this point the condition returns true and resets the counter. An execution count of 1 therefore returns always true since it counts to one, and resets the count to zero.

The condition produces following result:
Execution Count: 1 times: true, true, true, true, true, ...
Execution Count: 2 times: false, true, false, true, false, ...
Execution Count: 3 times: false, false, true, false, false, true, ...

Regards,
Martin

Post Reply