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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
NickHoff
Specialist
Specialist

Alternate State Variable in Set Analysis

I have a simple expression like the following, but it doesn't work.


SUM({Benchmark<ProcGroup= {"$(eProcedureGroup)"}>}BMHCA1PCT)


The variable eProcedureGroup is created @ script load with the following:  SET eProcedureGroup = 'GetFieldSelections(ProcGroup)';


I've tried the following as well:


SET eProcedureGroup = 'chr(34)&GetFieldSelections(ProcGroup)&chr(34)';

SET eProcedureGroup = 'chr(39)&GetFieldSelections(ProcGroup)&chr(39)';


When I view the variable in the same alternate state in a text box it gives me the selected ProcGroup from the alternate state 'Benchmark'.

I'm not sure why the variable is NOT working in the set analysis, but I think it has something to do with the Benchmark alternative state.  It used to work with ProcGroup = {'Total Knee'}, but there has been additional services added to the data.

I have ProcGroup which is a listbox filter on the alternate state Benchmark.  All the data on this tab uses the Benchmark alternate state.  Any ideas?

21 Replies
swuehl
MVP
MVP

I think you also need to quote the alternate state and maybe add an argument for the third argument.

And replace LET with SET:

This worked at my site:

SET eProcedureGroup = =chr(39) & GetFieldSelections( ProcGroup,chr(39)&','&chr(39),100,'Benchmark' ) & chr(39);

NickHoff
Specialist
Specialist
Author

I can get the text boxes to populate without an issue.  But, what I'm trying to accomplish with my set analysis shown below in the image doesn't work.

BM App.png

Also, adding the following variables don't display in the textbox when calling the variable, I also tried LET:

SET eProcedureGroup = "=chr(39) & GetFieldSelections( ProcGroup,chr(39)&','&chr(39),100,'Benchmark' ) & chr(39)";

SET eProcedureGroup1 = =chr(39) & GetFieldSelections( ProcGroup,chr(39)&','&chr(39),100,'Benchmark' ) & chr(39);

sunny_talwar

Remove the double quotes around your variable in the modifier

{Benchmark<ProcGroup= {$(eProcedureGroup)}>}

NickHoff
Specialist
Specialist
Author

Much easier than we made it out to be...  Thanks Sunny and Stefan.

sunny_talwar

qvelhoff‌ - I think Stefan deserve the correct answer more than me, because he is the one you got you on the right track. I think it would be better of if you mark his response as correct as most people will have more trouble sorting out the variable in script sorted out rather than getting the set analysis fixed.

Thanks and regards

Sunny

swuehl
MVP
MVP

I'm fine with that.

But could you please summarize which exact definitions you ended up with? I think that would be most helpful.

NickHoff
Specialist
Specialist
Author

My variable is defined as:  SET vProcedureGroup ="GetFieldSelections( ProcGroup , , , Benchmark)". 


The trouble was the double quotes around the variable.

sunny_talwar

Hahahahaha okay

swuehl
MVP
MVP

Ok, thanks, Nick. Does your variable work also when selecting multiple values?

NickHoff
Specialist
Specialist
Author

I don't believe it would, but for my use case ProcGroup is set as always one selected.  I'd have to use concat with your expression for it to work.