Trigger Variable map

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

Trigger Variable map

Post by yogi108 » 29 Jul 2017 16:13

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
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

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

Re: Trigger Variable map

Post by Desmanto » 30 Jul 2017 17:13

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.
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.

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

Re: Trigger Variable map

Post by Martin » 30 Jul 2017 19:07

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

User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

Re: Trigger Variable map

Post by yogi108 » 31 Jul 2017 06:04

Thanks both for testing and clarification!

Kind regards,
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: Trigger Variable map

Post by Bluscre » 13 Sep 2017 19:53

<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
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: Trigger Variable map

Post by Bluscre » 13 Sep 2017 20:11

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.
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

Post Reply