Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ben2r
Contributor III
Contributor III

Conditional Column Selection with List Box and User Friendly Field Names

Hi all, 

I am trying to find a solution to provide users with the ability to build up a table from a selection list box. In the past we have done this through using data islands for each custom table and mapping the data island tables with the conditional show hide. Upon researching data model efficiency I have come to the conclusion that data island are bad and cause slower dashboard speeds. 

The first solution I discovered to this was using expressions in a list box to match to fields in the data model. For example, the list box would look like this: 

=IF(MATCH($Field,'Field_A','Field_B','Field_C','Field_D'),$Field)

This works as I can make the conditional show / hide in the table columns as below: 

=SubStringCount(concat($Field,'|'),'Field_A')

This gives me a solution that works, but means I have to show internal field names in the list box which is not appealing to an end user. 

If found a great solution to this here: https://www.qlikviewaddict.com/2013/05/user-friendly-field-names-in-qlikview.html which uses a mapping table for old and new names. 

However - doing this creates a data island. I can live with having just one island for the purposes of this. The new custom expression looks like this: 

=IF(MATCH($Field,'Field_A','Field_B','Field_C','Field_D'),UserFriendlyFieldName)

Now if I want to apply this approach across multiple tables with different columns, I get one long list of fields in the list box (the list of UserFriendlyFieldName) rather than the values I enter into the custom expression. 

Im struggling to close the loop on this final part. Does anyone have any advice / guidance on how to solve the initial requirement in a data model efficient way? I appreciate changing field names in the data model would be an option also but the client would prefer not to do this. 

 

Labels (2)
1 Solution

Accepted Solutions
ben2r
Contributor III
Contributor III
Author

I was going to delete this in embarrassment as I have just worked it out and it is now glaringly obvious but sharing the solution in case helps anyone..! 

In the original site I came across, we were doing a lookup on $Field since that was fine if you are only using one lookup box. 

If I want to do multiple boxes, I can just replace $Field with 'ExistingFieldName'. That way, when we do the floating table it can have values from multiple tables, but only those we define in the list box 'expression' formula will appear for selection. 

New custom expression: 

=IF(MATCH(ExistingFieldName,'Field_A','Field_B','Field_C','Field_D'),UserFriendlyFieldName)

Temp table which makes this work looks like: 

LOAD * INLINE [

ExistingFieldName, UserFriendlyFieldName

Field_A, New Name for Field A

etc

];

 

View solution in original post

1 Reply
ben2r
Contributor III
Contributor III
Author

I was going to delete this in embarrassment as I have just worked it out and it is now glaringly obvious but sharing the solution in case helps anyone..! 

In the original site I came across, we were doing a lookup on $Field since that was fine if you are only using one lookup box. 

If I want to do multiple boxes, I can just replace $Field with 'ExistingFieldName'. That way, when we do the floating table it can have values from multiple tables, but only those we define in the list box 'expression' formula will appear for selection. 

New custom expression: 

=IF(MATCH(ExistingFieldName,'Field_A','Field_B','Field_C','Field_D'),UserFriendlyFieldName)

Temp table which makes this work looks like: 

LOAD * INLINE [

ExistingFieldName, UserFriendlyFieldName

Field_A, New Name for Field A

etc

];