
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Changing Variable Value When Field Is Cleared Of Selections
Hi everyone,
I have a field called 'TransactionDate' which, when I clear it, needs to change the value of a variable, vLastWeekTrans, to 0.
I'm trying to use the current expression in the variable's 'Definition' box and am not getting any result:
=if(GetSelectedCount(TransactionDate)<1, 0,1)
Thanks in advance for any help.
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your buttons you force the value of your variable vLastWeekTrans to 1 => It's clear th definition.
Two solutions :
1. In the definition of the variable put the formula if(GetSelectedCount(TransactionDate)<1, 0,1) (without the equal sign) and nothing in the button
2. If you absolutely want the action on the button : create the variable without definition and then in each button on the action on the variable put the formula if(GetSelectedCount(TransactionDate)<1, 0,1) (without the equal sign)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works for me
Definition of the variable if(GetSelectedCount(TransactionDate)<1, 0,1) (without the equal sign)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Sabrina,
I've tried this and, once I've updated the definition, it works (i.e. it changes the variable value). I click the button again and then clear the selection and it doesn't work.
Could there be anything that overrules the definition of a variable?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I try multiple times and it works fine for me. Could you add your app ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can add without data if that's ok?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the app. The variable is acting on the background and font colours in the first button on the left underneath the blue banner.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your buttons you force the value of your variable vLastWeekTrans to 1 => It's clear th definition.
Two solutions :
1. In the definition of the variable put the formula if(GetSelectedCount(TransactionDate)<1, 0,1) (without the equal sign) and nothing in the button
2. If you absolutely want the action on the button : create the variable without definition and then in each button on the action on the variable put the formula if(GetSelectedCount(TransactionDate)<1, 0,1) (without the equal sign)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is working really well, thank you Sabrina!
I have one button that's in an alternate state and this method isn't working for that button. Is there an adjustment I need to make when dealing with variables in alternate states?
Many thanks once again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please see this issue : LINK

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The best solution I can seem to find is the following:
if(GetSelectedCount(TransactionDate, 'WoW')<1, 0,1)
'WoW' being the name of the state. The problem is it doesn't clear when the field is cleared of selections.

- « Previous Replies
-
- 1
- 2
- Next Replies »