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: 
Not applicable

Using a variable to hold part of a variable name to use in an expression

Hello

I have a set of numeric columns:

Buildings Incurred

Contents Incurred

Other Incurred

I have a variable called polsection and it contains the first part of the variable name, e.g. "Buildings", "Contents", "Other"

I want to write a table expression that joins this variable to a string to create the full variable name and sums the value of the field.

I've tried

=sum(=$(polsection)&' Incurred')

and

=sum([$(polsection)&' Incurred'])

and every other combination of symbols I can think of.

Is this even possible? If so how do I do it?

Many thanks!

1 Solution

Accepted Solutions
Not applicable
Author

Try the function  Getfieldselection

For example variablename  =GetFieldSelection (ListBoxName,',')   in the Variable Overview..

View solution in original post

4 Replies
Miguel_Angel_Baeyens

Hi,

Yes, that should work, and you are very close:

Sum([$(polsection) Incurred])

Hope that helps.

Miguel

MayilVahanan

Hi

Try like this

variableName

its value ='Buildings'

Then in expression


Sum($(polsection) Incurred)

Ex:

PFA

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks Mayil

The only other issue is that I want the variable value (='Buildings', ='Contents', etc...) to be selectable in a list box. So I'm trying to use a trigger on list box selection to put the value into a variable, but I don't know how to put ='Buildings' into the variable.

Do you know how to do this?

Thanks.

Not applicable
Author

Try the function  Getfieldselection

For example variablename  =GetFieldSelection (ListBoxName,',')   in the Variable Overview..