Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GetFieldSelections() to return individual values

Hi all,

I'm trying to create a straight table that compares year-over-year revenue. Each year in the data set is a new column in the table, with the expression being the sum of revenue. When no years are selected (in list boxes), the table should show all years. When a year/multiple years are selected, I want the deselected column years to hide. To do so, I'm using a condition on each expression using GetFieldSelections() as show below (this example would be for column/year 2011):

GetFieldSelections(CalendarYear) = '2011' or GetSelectedCount(CalendarYear) = 0

The second part of the condition works correctly (show column if no fields are selected), but the GetFieldSelections() function won't work here for all cases because the return type is a string of values separated by a comma. If only year 2011 is selected, the condition works as desired, but when multiple years are selected (including 2011), the function return multiple years and the condition is always executed as false. Is there another string function I can use here to see if a certain value exists in the set?

1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can use

Index(GetFieldSelection(CalendarYear), 2011) >0

Regards

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

3 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can use

Index(GetFieldSelection(CalendarYear), 2011) >0

Regards

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
Anonymous
Not applicable
Author

Paul,

Take a look at the index() function in combination with concat:

index(concat(distinct [Calendar Year], ','), '2011')

no need to check for "no selections" anymore

Regards,

Michael

Not applicable
Author

Perfect, thanks!