Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
WE ARE LISTENING! New Navigation for Qlik Community, Sept. 26: TELL ME MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Perus_Pena
Contributor III
Contributor III

Using GetSelectedFields in set analysis via variable

Hello everyone,

I have simple table listing months which is used to select YearMonth values from multiple tables. I have then multiple measures that I'd like to declare as variables in the Script editor. I will be calculating e.g. v.Count_A / v.Count_B type of measures.

This works as a measure: COUNT(distinct {<YearMonth={'$(=getfieldselections(SelectedPerioid))'}>} %_ID)

But if I use this in QlikScript like this:

Let v.Count = 'COUNT(distinct {<YearMonth={"$(=getfieldselections(SelectedPerioid))"}>} %_ID)';

--> Will show COUNT(distinct {<YearMonth={""}>} %_ID) on the app side.

I guess the $ will make the script will return "" for the field selection as there is no variable with that name. So how can I force that $(=get...Perioid) to be used on the app side?

Regards,

Pena

Labels (3)
1 Solution

Accepted Solutions
agigliotti
Partner - Master III
Partner - Master III

let's try with the below syntax:

LET v.Count = 'COUNT(distinct {<YearMonth={' & '$' & '(=getfieldselections(SelectedPerioid))}>} %_ID)';

I hope this could help.

View solution in original post

2 Replies
agigliotti
Partner - Master III
Partner - Master III

let's try with the below syntax:

LET v.Count = 'COUNT(distinct {<YearMonth={' & '$' & '(=getfieldselections(SelectedPerioid))}>} %_ID)';

I hope this could help.

Perus_Pena
Contributor III
Contributor III
Author

Thanks, this worked perfectly!