Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create variable string name in expression

Hi all,

I'm trying to access the information inside a variable by constructing the variable string name in an expression. All of my variables were created using the format "v" + [Client Name]. For instance, the company "Acme" would have a variable vAcme.

I would like to dynamically access the variables in a straight table that uses the Client Name as an expression. I have been unable to access the variable information using my current methods. My expression looks something like this:

='$(v' & [Client Name] & ')'

This returns NULL. Is there a reason this does not work? Can I update my syntax to make it return the variable value?

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

You can do that but its more complicated.  You need to load the variable names in the load script for each client and then use the PICK() function

Take a look at the attached example (QVW).

Highlights below in the screenshots

Capture1.PNG.png

Capture2.PNG.png

Capture3.PNG.png

Capture4.PNG.png

View solution in original post

4 Replies
JonnyPoole
Employee
Employee

This may work:


=$(='v' & [Client Name])

But if its in a text box and there are multiple client names you'll need to select only one client name and perhaps use only() function

=$(='v' & only( [Client Name]))


the  '=' inside the dollar sign expansion will build a string with the right variable name. the $() will evaluate it as a variable.

Not applicable
Author

This is great, but is it possible to use a similar formula in a straight table? My dimension is [Client Name], so I would assume the expression would be able to parse through and choose the current row item/client name, but this expression only works, as you mentioned, when a specific client is selected.

JonnyPoole
Employee
Employee

You can do that but its more complicated.  You need to load the variable names in the load script for each client and then use the PICK() function

Take a look at the attached example (QVW).

Highlights below in the screenshots

Capture1.PNG.png

Capture2.PNG.png

Capture3.PNG.png

Capture4.PNG.png

Not applicable
Author

Thanks! This works great.