Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

HOWTO: Assign a variable to another variable through an Action expression

I recently ran into a situation where I want to change a chart expression, based on a selection.

The easy way to do this is by having the expression saved as a variable, and then assigning that variable name to the placeholder variable contained within the expression.

So far so good. However, where things fall down is if you attempt to assign _the name_ of a variable to another variable from within a trigger action. Namely, QlikView wants to resolve the contents of the variable as opposed to the name of the variable.

One solution is to make the assignment within a macro (e.g. VBScript or JScript). However, I prefer to avoid using Macros as they result in more code to maintain, and often have performance limitations.

The trick turns out to be relatively simple. Namely, just concatenate the $ part of the variable reference to the rest of the variable name.

I have pasted the code below to show you what I mean:


='$' & if(OH_hierarchy_levels_entity_name = 'Org3HierarchyLevels', '(CurrentScoreExpression7Levels)', '(CurrentScoreExpression6Levels)')


0 Replies