Trigger for when a variable changes

Trigger for when a variable changes

Hi Michael, can you clarify what you mean by this and say a bit more about your use case? Thanks!

not OP but: when the value of a variable in an app changes, be able to specify Then/Else/Transition block(s)

Hello @melllerbeck do you mean at a the beginning of the trigger so adding to the when dropdown the selection of variable?

Yes, kindof an event handler on the variable. Iā€™ve ran across it in Qlikview is where the idea stems from

n this group you can set actions to trigger on changes in the contents of a specified variable in the document.
Select a variable in the list and press one of the buttons to assign an action to it. The buttons open the Actions page. On this page you can add an action to the trigger. Choose the action macro to assign an existing macro name or type any name for which you later can create a macro in the Edit Module dialog.
When an action has been assigned to the variable, the button changes to Edit Action and you can change the action for the event. The following Variable Event Triggers exist:
OnInput
The action will be executed each time a new value is directly entered in the selected variable.
OnChange
The action will be executed each time the value of the selected variable changes as a result of changes in other variables or the logical state of the document. This typically applies when the variable contains a formula.

2 Likes

Is it possible? I canā€™t find this kind of event handlerā€¦

@ChrisF, there is not currently a ā€˜When Variable Changesā€™ trigger. can you share a little about what youā€™re trying to achieve?? hopefully we can find an alternative solution!! thanks, and welcome back to Tulip Community.

Hi gio,
a simple example: dropwdown with 20 entries. To proof the variable of this checkbox can be done within a timer (unproofed) or at pressing a button (like next).
Another example: format proofing (for correct date-time format) when typing it into a text field.
Regards Chris

thanks @ChrisF!! validation can certainly be placed on the Timer or Button Press triggers.

for example, this trigger is checking if the Text Entry for a date contains 11, and displaying November if so:

just to confirm, is this what youā€™re trying to achieve?? apologies if Iā€™m not understanding correctly!!

Hi Gio,
sorry for the delay.
Yes, a simple but correct example.
But for a better user experiance it is irritating the employers when changing a value from the dropdown and the correspodning other fields are the same. Sometime the employers forget to tap the button and wondering why the other values are the same (unchanged); one step less to do.

It should like an interactive table when selecting a record/row.

Regards Chris

Another use case example:
I have a numeric input widget and submit button for applying qty changes. I wish I could color the submit button red when the variable is negative or green when positive, easy visual indication of the action the operator is about to perform. The numeric input widget only offers ā€˜on enterā€™ which never gets used with quick data entry (tabbing thru), and the step timer trigger is now limited to 30sec, so itā€™s not responsive enough either. Having an ā€˜on-changeā€™ trigger for a variable or the numeric input widget would be ideal.

Hi @jmat,

you can built a custom widget to observe a variable and take actionā€¦

Yes if time allows, but reacting to changes feels like a crucial feature for UI development. ā€œOn changeā€ has been a standard feature available in some form with every other platform Iā€™ve used. Itā€™s typically on the objects(widgets) rather than the variables, but I felt the OPs suggestion was very valid.

1 Like

For those who might be interested, there is a custom widget maintained by the Tulip team that allows to execute a set of triggers when a Text or Number variable changes.

Change Detection Widget

[EDIT: About variable change triggers:] I will add that it might not be a simple change since you have to detect infinite loops of change events to stop them and report it to the user ; that kind of situation can also potentially be dreadful to debug, especially if the error message isnā€™t precise enough.