Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dears,
I am making a table that contain many columns and user can select the columns they are interested in.
I separated the columns in groups, so it is easier to search for items.
The problem happened when selecting multiple items in same filter.
In pictures an example, when I select only one under Figures filter, I will get the column but if both selected, they will be hidden.
And here after selecting both:
I am using this code for each Item in the table (Show column if):
=If(SubStringCount('Gross Premium',GetFieldSelections(_FigureField))>0,1,0)
=If(SubStringCount('Sum Insured',GetFieldSelections(_FigureField))>0,1,0)
I Appreciate any suggestions you have and if you have other way or source I can learn from.
I was so confused when you reported that my suggestion did not solve your issue, so I had to create a sample app.
When working on it I realize that we are using SubStringCount() wrongly, the correct syntax is SubStringCount(text, sub_string) and we have used it like this: SubStringCount(sub_string, text)
As you will see in the app, both Concat() and GetFieldSelections () will work (but if you have more than 6 values in _FigureField, then you will have to configure GetFieldSelections() in order to not get the 'All' string) But notice the difference between the two approaches when you have no values selected. (last picture)
This works:
If(SubStringCount(concat(_FigureField,', '),'Sum Insured',)>0,1,0)
If(SubStringCount(concat(_FigureField,', '),'Gross Premium')>0,1,0)
The GetFieldSelections will return 'ALL' when all values are selected. None of your substrings are found in the string 'ALL' See https://help.qlik.com/en-US/sense/February2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/Field...
You could try to replace
GetFieldSelections(_FigureField)
With the following:
Concat(distinct _FigureField, ',')
From my understanding, GetFieldSelections will return values and separated by ","
Concat(distinct _FigureField, ',') will merge the selected with "," , did I get it correctly?
I modified the code to the following and it is still the same problem, it returns only one selected item:
=If(SubStringCount('Gross Premium',Concat(distinct _FigureField, ','))>0,1,0)
Same for Sum insured
Did I do your approach in a wrong way?
Thanks for your help
I was so confused when you reported that my suggestion did not solve your issue, so I had to create a sample app.
When working on it I realize that we are using SubStringCount() wrongly, the correct syntax is SubStringCount(text, sub_string) and we have used it like this: SubStringCount(sub_string, text)
As you will see in the app, both Concat() and GetFieldSelections () will work (but if you have more than 6 values in _FigureField, then you will have to configure GetFieldSelections() in order to not get the 'All' string) But notice the difference between the two approaches when you have no values selected. (last picture)
This works:
If(SubStringCount(concat(_FigureField,', '),'Sum Insured',)>0,1,0)
If(SubStringCount(concat(_FigureField,', '),'Gross Premium')>0,1,0)