Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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).
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?
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