# Trigger for when a variable changes

**URL:** <https://community.tulip.co/t/trigger-for-when-a-variable-changes/463>\
**Category:** Product Suggestions\
**Created:** [June 10, 2020, 9:27pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463 "2020-06-10T21:27:08Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mellerbeck](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mellerbeck](https://community.tulip.co/u/mellerbeck)\
**Post date:** [June 10, 2020, 9:27pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/1 "2020-06-10T21:27:09Z")

</div>

Trigger for when a variable changes

---

<div class="post-metadata">

**Author:** ![saul](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/saul/32/37_2.png) [@saul](https://community.tulip.co/u/saul)\
**Post date:** [June 12, 2020, 9:44pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/2 "2020-06-12T21:44:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justin.mai](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@justin.mai](https://community.tulip.co/u/justin.mai)\
**Post date:** [June 19, 2020, 8:23pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/3 "2020-06-19T20:23:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CPS\_Chris\_Winters](https://avatars.discourse-cdn.com/v4/letter/c/74df32/32.png) [@CPS\_Chris\_Winters](https://community.tulip.co/u/CPS_Chris_Winters)\
**Post date:** [June 23, 2020, 6:32pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/4 "2020-06-23T18:32:08Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/1X/cc161d7c97237e5158d0d4eebddd4ae826a7e881.png)

---

<div class="post-metadata">

**Author:** ![mellerbeck](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mellerbeck](https://community.tulip.co/u/mellerbeck)\
**Post date:** [June 23, 2020, 10:06pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/5 "2020-06-23T22:06:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://community.tulip.co/u/ChrisF)\
**Post date:** [October 28, 2020, 8:43am UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/6 "2020-10-28T08:43:24Z")

</div>

Is it possible? I can’t find this kind of event handler…

---

<div class="post-metadata">

**Author:** ![gio](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/gio/32/82_2.png) [@gio](https://community.tulip.co/u/gio)\
**Post date:** [November 4, 2020, 8:25am UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/7 "2020-11-04T08:25:28Z")

</div>

> [@ChrisF](#):
>
> Is it possible?

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

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://community.tulip.co/u/ChrisF)\
**Post date:** [November 12, 2020, 12:51pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/8 "2020-11-12T12:51:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gio](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/gio/32/82_2.png) [@gio](https://community.tulip.co/u/gio)\
**Post date:** [November 12, 2020, 1:59pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/9 "2020-11-12T13:59:56Z")

</div>

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:

 ![Screen Shot 2](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/1X/ce7d1baef300af0942b32613f20774d47dce179a.jpeg)

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

---

<div class="post-metadata">

**Author:** ![ChrisF](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@ChrisF](https://community.tulip.co/u/ChrisF)\
**Post date:** [January 14, 2021, 6:56am UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/10 "2021-01-14T06:56:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jmat](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jmat](https://community.tulip.co/u/jmat)\
**Post date:** [November 29, 2023, 10:20pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/11 "2023-11-29T22:20:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thorsten.langner](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thorsten.langner](https://community.tulip.co/u/thorsten.langner)\
**Post date:** [November 30, 2023, 8:53am UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/12 "2023-11-30T08:53:34Z")

</div>

Hi @jmat,

you can built a custom widget to observe a variable and take action…

---

<div class="post-metadata">

**Author:** ![jmat](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jmat](https://community.tulip.co/u/jmat)\
**Post date:** [November 30, 2023, 2:03pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/13 "2023-11-30T14:03:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fti](https://avatars.discourse-cdn.com/v4/letter/f/fbc32d/32.png) [@fti](https://community.tulip.co/u/fti)\
**Post date:** [December 11, 2024, 5:49pm UTC](https://community.tulip.co/t/trigger-for-when-a-variable-changes/463/14 "2024-12-11T17:49:07Z")

</div>

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](https://library.tulip.co/apps/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.
