Trigger "global variable"
Moderator: Martin
- TheBrain1984
- Posts: 137
- Joined: 07 Aug 2013 08:17
- Location: Germany
Trigger "global variable"
Can it be that the trigger won't be triggered if the global variable is a list and you add or remove an element? Is this a bug or a feature?
Re: Trigger "global variable"
This is a "feature". The trigger will only execute when another value is assigned to a global variable. This design decision was mostly done for performance and simplicity reasons since Automagic otherwise would have to monitor each list and map for modifications which would greatly slow down modifications of such structures.
You can avoid this issue by assigning the size of the list to a separate global variable when you modify the list and by triggering on the size variable or by creating a copy of the list and assigning this copy to the global variable when the modifications have been applied, for example:
You can avoid this issue by assigning the size of the list to a separate global variable when you modify the list and by triggering on the size variable or by creating a copy of the list and assigning this copy to the global variable when the modifications have been applied, for example:
Code: Select all
list = copyList(global_list);
addElement(list, "xyz");
global_list = list;