Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Assign variable from within expression

Hi there,

It may be a simple question but I am struggling to find the answer, What I want to do, is to assign a variable based upon a selection in my chart i.e. if(Sum(Data)>=0,Sum(Data) and myVar = 'Positive' )

Can anyone take a minute to assist?

Cheers

Chris

4 Replies
Not applicable
Author

Hi Chris,

You mean like this: if(sum(Data) >= 0, 'positive', 'negative').

If you can provide details, like a sample qvw and the required result, it may be clearer.

Not applicable
Author

Hi,

Thanks so much for your help. I have attached a small sample file.

The idea is, when I click on the cyclic group button in the bottom left of the graph, the variable (myVar) is populated with the appropriate value ('positive' or 'negative').

Not applicable
Author

Actually, the expression cyclic group is not controllable (like the dimension cyclic that can be controlled by the function GetCurrentField() to know which field is selected within the group).

So the attached file may be a workaround.

I added a flag (variable vFlag) to select whether to display positive or negative values (2 text boxes with an action trigger) and then the variable myVar can be set accordingly (the 3rd text box that reads the content of variable myVar).

The pie chart expressions are also displayed based on the selection of "positive" or "negative" from the conditional property.

Hope this helps

Not applicable
Author

Ahhhh, a very nice work around!

Unfortunate though that this limitation on cyclic groups exists in Qlikview. None the less, your solution solves my problem to a tee.

Thanks so much Jean-Pierre!