Execution Count condition issues

Post your questions and help other users.

Moderator: Martin

Post Reply
vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Execution Count condition issues

Post by vertigo » 22 Jun 2020 23:33

I just used this condition for the first time, and it caused me some issues due to lack of clarity and a possible bug. I have it figured out now, but it could definitely be improved (and fixed?).

First, it's not clear in the help page that it's global, i.e. that it carries over to subsequent flow executions. Now that I know that, I realize I need to use the timeout option, but a) it should make that more clear, and b) there should be an option to reset it once the flow ends.

Second, the reason it took me as long as it did to figure that out, and why I thought at first there was a bug with how the condition runs, is because after it returned true when it shouldn't have, I started periodically opening it to check its value ("Current value"), but that was 0 every time I checked, and even right after checking and seeing it set at 0, it would return true. So either that's not what that's for, in which case it should be more clear, or it's not working properly.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Execution Count condition issues

Post by Desmanto » 05 Jul 2020 17:54

Yeah, I have ever post this too, but of course have been buried deep inside the forum. viewtopic.php?f=5&t=7594&p=22232&hilit= ... unt#p22232

We have the field to show the current execution count, but no way to reset it yet. Maybe we can request it properly in the feature request subforum. So far, the only way to reset it is to use timed and use a reasonable timeframe as stated in my post above.


If the condition return true, maybe that execution count is executed twice in succession. Try to check your flow for multiple branching, and try to put that element into new flow and test again with minimum element. You can also try to use different count, example 10, to see if it still return true. Check the counter after executed.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Execution Count condition issues

Post by vertigo » 05 Jul 2020 18:43

I think you misunderstood the problem. It's not branching-related or anything else like that. It was returning true when (I thought) it shouldn't have because I would run the flow, it would increment the counter, then I would run the flow again and it would be at the set count. The problem was two-fold: 1) I didn't realize the counter would carry over into subsequent runs, instead thinking it was only for the current running instance, and 2) the field that shows the current execution count (or at least it appears that's its purpose), doesn't. It just always says zero (0).

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Execution Count condition issues

Post by Desmanto » 06 Jul 2020 17:49

The Counter is stored just like glovar, so yes it carries over to the next execution. This behaviour allow you to design flow with 2 times trigger to execute main flow, such as the combination of the vol up + down. You can mimic the same behaviour using expression and save the counter into glovar. Or you can use the local variable version to have it reset at every execution (as shown in my link post above).

At mine, the counter is incremented properly. Try to open the execution count condition and execute it manually. It should increased to 1.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Execution Count condition issues

Post by vertigo » 06 Jul 2020 20:07

I executed it manually (didn't even know that was possible) and it did increment, so not sure why it doesn't if I run the flow then check it. Definitely seems to be a bug.

Also, as mentioned, the bigger issue here is that the help page for the condition simply isn't clear at all about the fact it's a global check. At a minimum, the page should be modified to state that, though it would be nice if there were a checkbox to toggle between global and local. Sure, it can be done with some script, but so could its current functionality, and if there's going to be a template shortcut for the function, which is great for saving time and making things simpler, why not go all the way and make it work both ways? I guess I'll have to post that in feature requests.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Execution Count condition issues

Post by vertigo » 06 Jul 2020 20:12


Post Reply