Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

getfieldselections in set analysis

Hi everyone,

Has anyone ever used the getfieldselections within a set analysis as a set modifier?

This is how I tried to accomplish it but so far without working result:

attempt 1: within the set analysis

=avg({1<ext_nis_gewest_naam={'Vlaams Gewest'},ext_data_monthyear={$(=getfieldselection(ext_data_monthyear,','))})>}ext_data_waarde_abs)/Axis_Slider

attempt 2: with the getfieldselection in a variable

=avg({1<ext_nis_gewest_naam={'Vlaams Gewest'},ext_data_monthyear={$(#selectionmonthyear})>}ext_data_waarde_abs)/Axis_Slider

Thank you in advance,

Kr,

Kevin

1 Solution

Accepted Solutions
karolina_
Creator II
Creator II

try

=replace(Concat(DISTINCT chr(39)&GetFieldSelections([Field Name])&chr(39),','),',',chr(39)&','&chr(39))

View solution in original post

9 Replies
karolina_
Creator II
Creator II

you have wrong brakets in second ver near variable #selectionmonthyear:
{$(#selectionmonthyear})>}

have you tried quotation marks:
{ '$(#selectionmonthyear)' }

Not applicable
Author

The brackets outside the $expansion do the trick as long as I select only one value. once I select multiple he can't cope with the result from the 'getfieldselection'

I also added an 'if' to my getfieldselection to take '*' in case nothing was selected.

Thanks a lot for the quick response!

Regards

karolina_
Creator II
Creator II

I have something like that:
variable: vCurrent
Concat(DISTINCT chr(39)&[Field name]&chr(39),',')

Aggr(only({1<[Field name] -= {$(=$(vCurrentINames))} >} [Field name]),[Field name])

my variable show possible values.

you can try

=Concat(DISTINCT chr(39)&GetFieldSelections([Field name])&chr(39),',')

and then use {$(=$(vCurrent))}

the aim of this variable is to do search string so u can use it in set analysis



Not applicable
Author

try this

=avg({1<ext_nis_gewest_naam={'Vlaams Gewest'},ext_data_monthyear={$(=getfieldselection(ext_data_monthyear,','))})>}ext_data_waarde_abs)/Axis_Slider


replace with :

getfieldselection(ext_data_monthyear,',',8)


or make ur variable like : getfieldselection(ext_data_monthyear,',',8)  - depending which expresion you use ofc.

Not applicable
Author

Karolina,

=Concat(DISTINCT chr(39)&GetFieldSelections([Field name])&chr(39),',') puts the brackets on the outside ('dec-2007, dec-2008') whereas  the correct format should be 'dec-2007','dec-2008'


Unless I understood it the wrong way,


thank you again for your quick reply!


Kr,

Kevin

karolina_
Creator II
Creator II

Yes,you're right i didnt notice it

Maybe then you can use

variable: vCurrent

Concat(DISTINCT chr(39)&[Field name]&chr(39),',')

and in the place where you want to use it check if selection was made
.

=if(GetSelectedCount([Field name]),

Aggr(only({1<[Field name] = {$(=$(vCurrentI))} >} [Field name]),[Field name]),

Here put epression when no selections are made
)

karolina_
Creator II
Creator II

try

=replace(Concat(DISTINCT chr(39)&GetFieldSelections([Field Name])&chr(39),','),',',chr(39)&','&chr(39))

Not applicable
Author

Bingo!

Thank you very much!

Kevin

karolina_
Creator II
Creator II

Hi Kevin,

I changed expression I use for your requirements but i realized you do not need concat as GetFieldSelections give you Fields separated by comma. That's enough:

=chr(39)&replace(GetFieldSelections([Field Name]),',',chr(39)&','&chr(39))&chr(39)