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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
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?

1 Solution

Accepted Solutions
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);

View solution in original post

21 Replies
sunny_talwar

How about this:

LET eProcedureGroup = GetFieldSelections(Chr(39) & ProcGroup & Chr(39), ',', 'Benchmark');

NickHoff
Specialist
Specialist
Author

I think you are on to something.  I tried the following expression in a text box with the alternate state Benchmark.  I was able to get it to work as the following in a textbox.  However, it's still not working in the set analysis expression

=GetFieldSelections( ProcGroup , , , Benchmark)

ProcedureGroupVariable.png

ProcedureGroupText.png

BM App.png

sunny_talwar

You didn't add the single quotes using Chr(39). Is that for a reason?

NickHoff
Specialist
Specialist
Author

It wouldn't work with the single quotes, or double quotes chr(34).  Unless I had them incorrectly entered.

LET eProcedureGroup = 'GetFieldSelections(&Chr(39)&ProcGroup&Chr(39)& , , , Benchmark)' ;

sunny_talwar

Try removing these

LET eProcedureGroup = 'GetFieldSelections(&Chr(39)&ProcGroup&Chr(39)& , , , Benchmark)';

To this:

LET eProcedureGroup = 'GetFieldSelections(Chr(39)&ProcGroup&Chr(39) , , , Benchmark)';

sunny_talwar

Also try the above with set to see if that give you anything when you use the variable.

swuehl
MVP
MVP

I don't think GetFieldSelections() works with a calculated field as argument, try

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

NickHoff
Specialist
Specialist
Author

LET eProcedureGroup = 'GetFieldSelections(Chr(39)&ProcGroup&Chr(39) , , , Benchmark)';;

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

Top two text boxes are eProcedureGroup , second is eProcedureGroup1 :

variablesBM.png

4 variables.png

NickHoff
Specialist
Specialist
Author

Stefan, your response is the bottom two, with the syntax.

variablesBM.png

4 variables.png