Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
mlin
Contributor II
Contributor II

Evaluate string for Background expression

Hi, I'm trying to create a background expression formula that is dynamic and picks the variable based on an expression. I've done this in QV before but it doesn't seem to work in QS.

I've tried several combinations of different syntax, but the gist of it is trying to get a variable that says vColor1, vColor2, etc. where 1 is a calculation.

Concat('vColor',1)

'vColor' & '1'

'$(vColor' & '1)'

Has anyone gotten something like this to work? I'm trying to avoid creating a variable for each column and using the variable to evaluate..

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

Hi there!

I can tell that you would benefit a lot from Rob Wunderlich's session on Advanced Scripting at the Masters Summit for Qlik! He covers these tricky questions on variables with many interesting examples!

In your case, you need to calculate the name of the variable first, and then enclose it in the dollar-sign expansion, to replace the name with the contents. So, you need two nested dollar-sign expansions, like this:

=$($(='vColor'&1))

This will do the trick.

To learn more advanced development techniques, check out the agenda of the Masters Summit for Qlik - coming soon to Orlando and to Dublin!