Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a peculiar problem that I am sure has an obvious answer but I am getting nowhere. Essentially the issue is this:
I have a listbox in which I can make only one selection at a time. When I change my selection in this listbox, I need to clear any selections that exist on another specific field. I need this to happen without a user having to press a 'clear' button or similar. I therefore decided to use a variable event trigger.
The variable stores the listbox selection, so when the selection changes, so to does the variable. I then added an 'OnChange' event trigger to this variable - the Clear Field action, specifying the field I require to be deselected. When I save and test this by changing my listbox selection, absolutely nothing happens - the other field retains any selections present.
This is odd because when I implement the exact same action on a text box, clicking the text box behaves as anticipated, clearing the field of selections. I know that the variable trigger is working because I have added other actions to the trigger which are behaving normally. I have also tried the Clear All action but that also does nothing.
Am I missing something about how the trigger works? I am sure that it must be possible to implement this logic...
Any help would be great
I'm guessing you have an action on the text boxes that "changes" what is in the variable (External > Set Variable)? By doing this, you are changing what is in the variable. Even if you are putting the same thing in it that was previously in there, you are still setting the variable with a "new" value.
However, if the variable is just a calculation for finding what field is selected, and you're changing selections in the field, the calculation in the variable itself isn't changing, and since it isn't changing, the trigger isn't being set off.
Note: This is all based on assumptions of how you have developed the report. I don't know what you're doing in the text box or the variable because you haven't shared all of the details.
Why did you put the trigger on a variable that contains the field selections? Why not just put the trigger on the field itself? If you put the trigger on the field, there is an on change action that should work for you.
You will find the Field Event Triggers under Settings > Document Properties > Triggers > Field Event Triggers, where you can find the field that you're making the selection on, and add an On Change event to update the other field.
Hi Nicole, thanks for your reply. Unfortunately the field I am trying to deselect does not appear on that list for some reason.
To be honest, someone else designed this application so I am trying to navigate my way round it. The field name is actually prefixed by a % sign so maybe this is causing the problem - what is this for?
The naming convention of % before the field name usually designates a key field. That shouldn't stop it from showing the field in your list though...
Can you post an example file?
Preparing examples for Upload - Reduction and Data Scrambling
Unfortunately I can't share it - I have double checked though and none of the fields marked with a % are showing in the list (from any tables). Must be something to do with that I guess. Not sure whether that would necessarily solve the issue though as I still don't understand why the action works in a text box but doesn't work in a trigger...
I'm guessing you have an action on the text boxes that "changes" what is in the variable (External > Set Variable)? By doing this, you are changing what is in the variable. Even if you are putting the same thing in it that was previously in there, you are still setting the variable with a "new" value.
However, if the variable is just a calculation for finding what field is selected, and you're changing selections in the field, the calculation in the variable itself isn't changing, and since it isn't changing, the trigger isn't being set off.
Note: This is all based on assumptions of how you have developed the report. I don't know what you're doing in the text box or the variable because you haven't shared all of the details.
Appreciate I haven't made it easy! I have looked into what you said about not actually triggering the variable event further and think that is actually what is happening. My definitions are as follows:
Text Box Action: Clear Field - %field_name
Variable Event OnChange Action: Clear Field - %field_name
Variable Definition: = only(%other_field)
The variable is therefore not technically changing, though the value it stores is changing. I feel like a trigger is the way to solve this, but how can I define a variable that is not an expression but stores the value selected and changes when this selection changes?
So I have now solved the issue!
The trigger on the variable event was having no effect because as you said, the variable was not actually changing. However, the % prefix was being used to hide the associated fields from the list (using the hideprefix command) so I have now reversed this. Now the field is on my list and I have been able to add a OnSelect action to that field as initially suggested and it works.
Lots learnt here - thanks for your help!