Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
awwitas
Contributor II
Contributor II

Possible to get column number or dimension name reference in a straight table?

I would like to be able to color or show/hide columns in a straight table based on the dimension name, so that I can have a single expression in the show/hide field that operates based on other mappings.

I cannot seem to find a way to get a column/dimension value from within the table itself. Is this possible?

For example:

I have a simple straight table like this, with no calculated fields (that is, each column is a simple dimension with the field name as the label).

awwitas_0-1699044971065.png

In the 'Background color expression' dimension details, I'd like to be able to use an expression that is something like this:

 

Pick(
    Match(	
    GetObjectDimension(ColumnNo())
    ,'ItemNM'
    ,'CountNBR'
    ,'ValueCD'
    ), red(), green(), blue())

 


The expected result would be that using a single expression, the <ItemNM> column would be colored red, <CountNBR> would be blue, etc.

The intended use would be having a single expression in a variable or similar that would color columns dynamically without me having to go in and change the field names in the dimension details every time I change or reorder the columns.

I know that ColumnNo() does not work in a straight table... is there any other function or methodology for identifying what the dimension or column in a table is from within the show/hide or color expression details?

Labels (1)
1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't know of any way to dynamically do what you want using the same expression for every dim.  If your goal is to map the Dim names to color or other properties in a flexible way I can suggest an alternative.  Make a table like:

DimName, DimColor
ItemNM, red()
CountNBR, green()
ValueCD, blue

And then use a color expression like:

=Only({<DimName={'ItemNM'}>}DimColor)

You will have to hard code the name value for each Dimension, but it's a fairly simple pattern and it gives you the external mapping. This is the best I've been able to come up with in the past. 

-Rob