Page 1 of 1

global variable

Posted: 01 Dec 2018 04:06
by Rafi4
hi Martin and all
give me one example about global variable trigger.
thanks from record4

Re: global variable

Posted: 01 Dec 2018 13:38
by digitalstone
Not much to explain really.
You type the glovar inside the trigger, and then when the value of that glovar changes, the flow will be triggered.

Re: global variable

Posted: 05 Dec 2018 10:53
by Helios
Maybe it is notable that changing a List or Map by, for example, adding or altering elements, does not trigger the flow.
It is only triggered if a new value is assigned to that global variable.

Re: global variable

Posted: 05 Dec 2018 19:09
by digitalstone
That is correct.
Variables that contain multiple values within such as lists and maps are not usable in this trigger.
The reason is (AFAIK) that Martin has no control over how many variables the user puts inside that map/list.
In which case Automagic could overload the user's phone with, let's say, 100 instances running on a single flow every second... that would be a problem.

Re: global variable

Posted: 09 Dec 2018 17:51
by Desmanto
If you want to use map or list as the glovar trigger, you have to change the whole map/list at once. You can't add just add/remove one element and hope it will be triggered. If map/list is still needed, you have to use another temporary glovar to identify the change. So you global_database as the map/list, which you can add/remove the element. After add/remove, change other global_temporary_status to something else, and use this as the trigger. At the script, later you can access the element from the global_database.