Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
baylor2016
Creator
Creator

Variable for dynamic set analysis string does not work.

Hi,

I am trying to use the dynamic set analysis string in my expression. When it is hard coded, it works fine. See below.

Count(DISTINCT {<PatientID = p({<Disease = p(Disease)>} PatientID)-p({NOT<[Disease]=p({NOT}Disease)>} PatientID)>} PatientID)

When I use a variable (sa_string)to generate a dynamic set analysis string in my expression, it does not work even though  the dynamic set analysis string, it is the same as hard coded, but still not working

=if(GetSelectedCount(Disease2)=0,'', if(GetSelectedCount(Disease,1,'NOT')=0,'{<PatientID = p({<Disease = p(Disease)>})>}',
'{<PatientID = p({<Disease = p(Disease)>})-p({NOT<[Disease]=p({NOT}Disease)>}'
))

=Count(DISTINCT $(sa_string) PatientID)

Sample attached

Thanks

Longmatch

1 Solution

Accepted Solutions
sunny_talwar

Today they both work the same way and there should be no difference between the two ways of writing this expression

View solution in original post

5 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

The content within the branches of your variable is not the same as in your working expression and I think this syntax is wrong. For example if I take the last part of your variable and compare it like:

{<PatientID = p({<Disease = p(Disease)>})-p({NOT<[Disease]=p({NOT}Disease)>}

{<PatientID = p({<Disease = p(Disease)>} PatientID)-p({NOT<[Disease]=p({NOT}Disease)>} PatientID)>}

which meant that PatientID is missing there.

- Marcus

baylor2016
Creator
Creator
Author

Actually, it does not matter whether PatietnID is in the set analysis string even though I don't know the reason. Please refer to the attachment.

sunny_talwar

I am seeing 2 when i opened up your application. Is 2 not what you expect to see?

Capture.PNG

baylor2016
Creator
Creator
Author

I checked the dynamic set analysis string, I did not enter correct set analysis string when items in both listboxes are selected. Sorry.

By the way, the following two set analysis strings return the same results.

{<PatientID = p({<Disease = p(Disease)>})>}

{<PatientID = p({<Disease = p(Disease)>}PatientID)>}

You use the first one, but most p() functions used in set analysis include field name. Does that make any difference?

Thanks

Longmatch


sunny_talwar

Today they both work the same way and there should be no difference between the two ways of writing this expression