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: 
klikgevoel
Contributor III
Contributor III

Conditional show of dimension value in table

Hi all,

I need to display some text within a table. However, when there are no values in a column, I do not want the column to show. An example is given below. So, for ID 1, the dimension named description 2 should not be displayed when ID 1 is chosen. For the other ID's, if chosen, all dimensions should show, even if for one year there is no data.

How would we work on this?

 

conditional table.PNG

 

Labels (2)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

For such columns you could write 'Show column if' expression like:

Len(MaxString([Description 2]))

 

View solution in original post

5 Replies
tresesco
MVP
MVP

What should be displayed when nothing is selected or IDs 1 and 3 are selected?
klikgevoel
Contributor III
Contributor III
Author

When nothing is selected the table isn't displayed, which I already did with a conditional display. For your second question it doesn't really matter whether Description 2 should be displayed or not. If it's easier to display all columns in that case, fine by me.
tresesco
MVP
MVP

For such columns you could write 'Show column if' expression like:

Len(MaxString([Description 2]))

 

klikgevoel
Contributor III
Contributor III
Author

Thanks, this works for my purpose! Could you elaborate the why behind this solution? After a quick search I found that MaxString() has the same function as Max() for integers, and Len() does what it says for strings. As such, this function evaluates; max string length. So Qlik does not show dimensions which evaluates to 0 aka null?
tresesco
MVP
MVP

Yes (somehow).

Actually the evaluation/technicality works like:

Qlik expect true/false from the expression written as condition. In qlik, numeric value zero is false, and non-zero number is true. Now my expression uses maxstring() an aggregation function to find the max string from available string values in that field. If there exists a value , it's length would be >0. Greater than zero value is evaluated as true and if no string values are there, the length would be returned as 0 which is false.

 

Hope this helps.