Page 1 of 1

Global variable and widget

Posted: 14 Nov 2019 08:53
by Lucy
Lol ive tried and tried, even imported flows but can never figure out how to add global variables properly. I have no idea what im doing even after reading tutorials

Re: Global variable and widget

Posted: 14 Nov 2019 13:43
by Wibbly
If you use a variable name in one flow where the variable name starts with "global_", then that variable (and it's contents) becomes available for use in any other flow

Re: Global variable and widget

Posted: 14 Nov 2019 13:47
by Lucy
Sorry, yeah i get the idea. I just cant seem to have any of them function with the associated values in widgets nor can i figure out a great number of correct values to do a lot of actions. But thank you

Re: Global variable and widget

Posted: 22 Nov 2019 17:23
by Desmanto
Glovar is just the same local variable as the ones you used, except it stays after the flow execution. Widget can also store value in the text field, so essentially makes them behave just like glovar, but with limited capability (it can't store map/list or event pure location type variable).

The widget text can be set to certain glovar, by using {global_text} in the text field. But I personally avoid this method. SInce we have to store our value first in the glovar, and increasing the glovar usage. The more glovar you have, the slower your overall flow execution, so avoid storing everything there.

I personally prefer to use setWidgetElementProperty(), to change the widget text directly from the script. This doesn't require glovar, and the value persist after execution (behaves just like glovar). Makes it perfect to store some text too. You can find the setWdiget function from the script/expression > function > find setWidget and you can choose to change any widget property you want.

Re: Global variable and widget

Posted: 22 Nov 2019 21:17
by Lucy
Thanks hunny... i sorted out my mistakes and got a grip on it now