Manipulating control values - display name vs code

Hi,

Is there a way in control to display a certain value in the control, e.g. for Department control ‘HR’ will be presented in the display name value and in the code value 111 will be picked and inserted into the parameter.

Thanks,
Amihai

There isn’t this functionality per se but I suppose you could have another calculated field that does the mapping like so:

  ifelse(
    $DEPARTMENT = 'HR', 111,
    $DEPARTMENT = 'ACCOUNTS',  112,
  ...
)

and the you would use this calculated field in your visuals, filters etc.

1 Like

I need this functionality as well. For the proposed solution, is this calculated field somehow applied to the parameter, the control, the filter?

I am a novice, so I don’t understand how the selection of “HR” from the parameter control dropdown results in passing “111” to the filter.

To use this in filters you would not use the parameter there but use a specific calculated field.
Example, if you want to add a filter depending on the control value selected (HR, ACCOUNTS, etc), you could set this calculated field:

  ifelse(
    $DEPARTMENT = 'HR' and {department} = 111, 1,
    $DEPARTMENT = 'ACCOUNTS' and {department} = 112, 1,
    ...
    isNull($DEPARTMENT), 1,
    0
)

where {department} is the field containing the numeric department value (coming from your dataset).

You would then need to add a filter to your visual that checks if this calculated field is equal to 1.