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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Conditional expression

Hi guys,

Can anyone explain the following expression please. It's being used as a conditional expression to show fields in a Pivot table.

Index('|'&concat(%FieldsFresh,'|')&'|', '|Fresh/Frozen|')
and
Len(GetFieldSelections(%FieldsFresh))>0

Thanks

Kieron

5 Replies
Not applicable
Author

It is trying to enable the dimension field when the dimension name is selected from a list box.

Index('|'&concat(%FieldsFresh,'|')&'|', '|Fresh/Frozen|')  --- it gives the field number with in the concat string
and
Len(GetFieldSelections(%FieldsFresh))>0 -- this is to make sure atleast one selection is made


you could write


substringcount(concat(%FieldsFresh,'|'), 'Fresh/Frozen')
and
Len(GetFieldSelections(%FieldsFresh))>0

Anonymous
Not applicable
Author

Thanks SC

Appreciate your help.

It makes more sense now.

rubenmarin

To further explain why the inital and final '|'.

Imagine you have this values: "Car" and "Caravan". With these values if the user selects "Caravan" and you don't have the starting and ending '|', the filter expression for "Car" also it's true, as the word "Caravan" contains "Car".

With the starting and ending '|', "|Car|" and "|Caravan|" only will be found when you select that exact values.

Anonymous
Not applicable
Author

Thanks RubenMarin,

I didn't know that yet.

So the '|' helps to fins only exact matches.

That's good to know

Not applicable
Author

Ruben you are right. i usually have a associated field in my dimension table (island table) like DimIdentifier field values  A, B, C... to avoid those issues .

substringcount(concat({<DimIdentifier ={'A'}>}%FieldsFresh,'|'), 'Fresh/Frozen')
and
Len(GetFieldSelections(%FieldsFresh))>0