Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issues with Alternate State and Variables

Hello!

We are facing some issues when using Alternate State and Variables,

We have a chart that uses vMaxAño variable and uses alternate states. We also have a listbox for selecting years (2013, 2014 and 2015)

When selecting a year sometimes the varible vMaxAño fails to update its value so if we select for instance 2013 the variable value remains in 2015 for some odd reason.

When minimizing the chart there doesn't seem to be a problem with the variable's value. We added a text object that shows vMaxAño variable value. As you can see, we selected 2013 but the text box shows 2015. We have made several tests but we can't  figure out what is going on

Is this a normal or expected behaviour when using alternate states and variables?

printscreen1.JPG

We have attached a simple demo that presents the issue. You have to select the year (Año) a few times till it randomly fails

16 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I see this interesting item in the 12.10 SR7 Release Notes:

"What’s new in QlikView 12.10 SR7

QlikView 12.10 SR7 includes only bug fixes. One behavior change between 11.20 and 12.x has been high-lighted regarding Alternate states and variables; In QV11.20 the variable was expanded in the first state encountered and this resulted in a random behavior when more than one alternate state was being used. Whereas in version 12 and up, the variable always belongs to a specific alternate state and this results in different behavior. Full details on the implications is described in a Support article, please contact Qlik Support if you need more information."

I've written up an extended explanation here: QV12 Variables with Alt State Fixed | Qlikview Cookbook

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

kmstephenson
Creator
Creator

Is this the same problem as to why this no longer works in QlikView 12?

=COUNT(DISTINCT {<var1_ind={1},var2_desc={'=IF(%Var2Desc=''Var2Desc1Abbrev'',''Var2Desc1Expand'',
IF(%ReadmissionMeasure=''Var2Desc2Abbrev'',''Var2Desc2Expand'',
IF(%ReadmissionMeasure=''Var2Desc3Abbrev'', Var2Desc3Expand'',''Var2Desc4'')))'},
var3_ind={1}>} Key)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The quotes are backwards per the current spec.  The outside quotes should be double quotes.

"=IF(%Var2Desc=....

The inner quotes should be single:

"=IF(%Var2Desc='Var2Desc1Abbrev'...


-Rob

kmstephenson
Creator
Creator

Hi Rob,

I also switched to this and it still did not resolve correctly, although no error message is shown and it reads "Expression OK". Is there anything else I could be missing? I checked to make sure that the IF expression resolves correctly outside of the Set Analysis. I also removed the IF and checked the value when var2_desc is hardcoded, and there wasn't a problem with the Set Analysis then.

=COUNT(DISTINCT {<var1_ind={1},var2_desc={"=IF(%Var2Desc='Var2Desc1Abbrev','Var2Desc1Expand',
IF(%Var2Desc='Var2Desc2Abbrev','Var2Desc2Expand',
IF(%Var2Desc='Var2Desc3Abbrev', Var2Desc3Expand','Var2Desc4')))"},
var3_ind={1}>} Key)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It makes sense that the quote change didn't fix it, as it won't be enforced until the Sept 2017 release.

I'll admit I don't quite understand what the expression is supposed to be doing. Can you explain?

-Rob

kmstephenson
Creator
Creator

So there is no workaround in the 12.10 version?

I have a listbox of %Var2Desc, that requires always one selected value.

Var2Dimension:

LOAD * INLINE [%Var2Desc

Var2Desc1Abbrev

Var2Desc2Abbrev

Var2Desc3Abbrev

Var2Desc4bbrev

];

My charts on the sheet update based on what measure is selected in %Var2Desc.  The fields are coming in on the dataset as var2_desc, but the values are not abbreviated and too long for the listbox that I want to use to toggle between measures.

Specifically, my data is based on different readmission measures (HEDIS, CMS MSSP, etc.) but I dummied up the code above to try to make it easier to read.

Does this make sense?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think I understand. You say it worked in QV11.20? If so, I would take the issue to QT support.

-Rob