Page 1 of 1

Trigger Variable map

Posted: 29 Jul 2017 16:13
by yogi108
Hi Martin,
I wonder if it is possible to use a map variable as a trigger?
I tested with global_test1["switch"], global_test1 is a multidimensional map,
the variable changes its value, but the flow doesn't trigger...

Thanks
Kind regards

Re: Trigger Variable map

Posted: 30 Jul 2017 17:13
by Desmanto
I have tried to make GloVar list. Contain only 2 values, 1 is time in milisec, other is just "on" / "off".
Tried to change only one the value, flow doesn't trigger.
Tried to set the trigger to global_test1[0], and change value only for that global_test1[0], still doesn't trigger.
Only changing both value will trigger global_test1. Which mean you have to seperate the value if you want to use it as trigger.

And remember, to change both value, it must be done in single line script, using newList().
I tried to set global_test1[0] = 1, and the next line global_test1[1] = "on". Flow doesn't trigger.

Don't know if it is designed this way or can be improved on the next update, to detect each element changes.

Re: Trigger Variable map

Posted: 30 Jul 2017 19:07
by Martin
Hi,

The trigger only detects when a different value is assigned to a global variable for performance reasons. An element addition/removal of a map/list is not detected.
As an alternate solution you could increment a global number each time the global map is changed or convert the map to a JSON string instead of using a native map.

Regards,
Martin

Re: Trigger Variable map

Posted: 31 Jul 2017 06:04
by yogi108
Thanks both for testing and clarification!

Kind regards,

Re: Trigger Variable map

Posted: 13 Sep 2017 19:53
by Bluscre
<merged>

Why isn't it possible to listen to map subkey changes without a extra expression? Is that by design? :O

http://automagic4android.com/flow.php?i ... 38b58aeb76

Re: Trigger Variable map

Posted: 13 Sep 2017 20:11
by Bluscre
Thats actually pretty sad. Having all these variables on their own is cluttering up the gloVar screen and takes away the usability for the users which made it so special in fhe first place and having them in either a map or a json string takes the ability to only listen on certain changes :/

Image

Being able to listen to

Code: Select all

{global_var["key"]["subkey"]}
for example would be dope.