Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Qlik Sense - passing strings into expression

Hi All,

I have a question. I am trying to write some dynamic code in an expression in Qlik Sense. Essentially, I am trying to dynamically construct the name of a field queried after. So, let's assume there is a field in my code called 'XYZ123', and I am trying to achieve the SUM(XYZ123), but in such a way that 'XYZ' and '123' are both stored as variables and are only concatenated within the query.

I am managing to achieve the desired string by using:

concatenate('$(var1)','$(var2)')

but it doesn't work whenever I try to pass it into an expression. I tried to do it more or less like that:

sum('$(concatenate(char(39)&$(var1)&(char39),(char39)&$(var2)&char(39))')

but I only managed to get 0 back. Do you know if there is any way of doing this efficiently in the front end?

Thanks,

Adam