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

Variable variable?

Hello,

Is it possible to use a chartname in a expression?

I would like to use a variable that could fetch the name of the chart so that the expression would be something like "Expression" $Variablle+"chartname".

Can that be done?

6 Replies
Not applicable
Author

Hi Per,

you can define a variable and use it in your charts.

Rainer

Not applicable
Author

Yes, but can I use the name of the chart to be the name of variable I want to call, say for instance that I have a variables named "Cars" and "Trucks" , then I have two charts named the same, can I then use a the same expressions on both charts, but in the chart "Cars" i want it to pick the variable "Cars" and in the chart "Trucks" I want to pick the variable "Trucks"

Not applicable
Author

Per,

please create a short example and describe the business need.

Otherwise I have the feeling I didn´t understood you right.

Rainer

Not applicable
Author

I'll try to explain it better.

I have this expression:


if(Nivå=32,if(Left(Rubrik,1)=' ' or isnull(Rubrik),'',((sum($(FilterSAN) if(År=IndexÅr and BokfPeriod<=AktuellMånad,(BokförtBelopp),0))
-sum($(FilterSAN) if(År=JämförelseÅr and BokfPeriod<=AktuellMånad,(BokförtBelopp),0)))
/sum($(FilterSAN) if(År=JämförelseÅr and BokfPeriod<=AktuellMånad,(BokförtBelopp),0)))),

(sum($(FilterSAN) if(År=IndexÅr and BokfPeriod<=AktuellMånad,(BokförtBelopp),0))
-sum($(FilterSAN) if(År=JämförelseÅr and BokfPeriod<=AktuellMånad,(BokförtBelopp),0)))
/sum($(FilterSAN) if(År=JämförelseÅr and BokfPeriod<=AktuellMånad,(BokförtBelopp),0)))


This I use in a chart, and I have 9 more that are similiar but the have another variable.

My plan was to take the whole expression and place it a variable, but since I have a unique variable in every expression I was thinking maybe it was possible to use the name of the chart to call the right variable, so that it in this case would be something like $(Filter +'Chartname') or something?

Not applicable
Author

Per,

sorry no cool idea at the moment.

Rainer

prieper
Master II
Master II

Hi,

do you just need to see 'Truck' somewhere in the header of the graphic?

Then you should have a look into the functions GETCURRENTFIELD (for groups) or GETFIELDSELECTIONS (for fields)

HTH

Peter