Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewuser20
Contributor III
Contributor III

getfieldselection into variable not working

Hi,

I have a strange behaviour of the GetfieldSelection function.

I have a field loaded into the script with AUTOGENERATE :

Annee_Test:
LOAD
$(vAnneeMin) + rowno()-1 as _Annee_Test
AUTOGENERATE $(vAnneeMax) - $(vAnneeMin) + 1;

In the application , i added a trigger onselect on the field _Annee_test and define a variable vAnneeTest: =GetFieldSelections(_Annee_Test)

Than i have a listbox with _Annee_Test and when i display the variable vAnneeTest it takes the value of _Annee_Test but when i choose   the max year or the max year-1 it stuck on the last selected value:

qlikviewuser20_2-1615455021742.png

 

qlikviewuser20_1-1615454995199.png

 

Labels (3)
1 Solution

Accepted Solutions
Or
MVP
MVP

Weird indeed. Perhaps you have competing triggers? At this point I don't really know what else to suggest... maybe try with a new variable / new name for the field and see if that fixes it.

View solution in original post

9 Replies
Or
MVP
MVP

I had a bit of trouble following along:

1) Your field appears to be Annee_Test, not _Annee_Test (with a leading underscore)

2) Why did you add a trigger? What does the trigger do?

qlikviewuser20
Contributor III
Contributor III
Author

1 ) it's _Annee_Test ? I just change the label in the listbox

2) I added a trigger on select to get the value of _Annee_Test into the variable vAnneeTest (Same result if i just declare the variable as =getfieldSlections(_Annee_Test)

Or
MVP
MVP

1) OK - obviously, there was no way to know that based on the image, so had to make sure that wasn't the issue

2) I'm not sure why you're doing it with a trigger instead of using a regular variable. OnSelect triggers are known to be somewhat wonky, particularly in the ajax client (for example, https://community.qlik.com/t5/QlikView-App-Dev/Onselect-Trigger-not-firing-when-selected-through-a-b... ) - are you able to use OnChange instead? If so, does that work as expected?

qlikviewuser20
Contributor III
Contributor III
Author

same thing with OnChange 

Or
MVP
MVP

I've attempted to test this locally and it works fine on my end, no matter which selections I make (QV 12.5 SR3).

You could try using a value of =_Annee_Test (instead of GetFieldSelections) and see if that works - obviously it'll only work for one year but it's worth testing out. You could also try with Concat(distinct Year,';').

Or
MVP
MVP

I've attempted to test this locally and it works fine on my end, no matter which selections I make (QV 12.5 SR3).

You could try using a value of =_Annee_Test (instead of GetFieldSelections) and see if that works - obviously it'll only work for one year but it's worth testing out. You could also try with Concat(distinct Year,';').

qlikviewuser20
Contributor III
Contributor III
Author

it is really weird . I also do the same thing in a separate application and it works.

But still not working in the other application , i also tried the web view and same thing

Or
MVP
MVP

Weird indeed. Perhaps you have competing triggers? At this point I don't really know what else to suggest... maybe try with a new variable / new name for the field and see if that fixes it.

qlikviewuser20
Contributor III
Contributor III
Author

i create a new variable with the same configuration and it works 🙂