Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Danny_Langley
Employee
Employee

Using GetFieldSelections in Set Analysis

Hi everyone,

My eyes are going crossed trying to figure this out. Please help!

I have a filter pane (Occupation) that I want to use to dynamically create a set analysis filter.

The following set statement is successful if I only select ONE value from my Occupation filter:

    

     count({<Occupation ={"$(=GetFieldSelections(Occupation,','))"}>}EMPLOYEE_COUNTER)


However, if I select more than one value then it can't evaluate successfully because the filter string that's built is missing quotes (' ')....so I added the Chr(39) below but can't get it to work at all now

     count({<Occupation ={"$(=Chr(39)&GetFieldSelections(Occupation,Chr(39)& ','&Chr(39))&Chr(39))"}>}EMPLOYEE_COUNTER)

The goal is to have a statement that looks like the follows after the user selects 'Doctor', 'Nurse', and 'Firefighter' from the Occupation filter.

count({<Occupation = {'Doctor','Nurse','Firefighter'}>}EMPLOYEE_COUNTER)

Or if you can think of a better way to do it in general than what I'm doing, I'm all ears as well.

Thanks in advance!

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

But why do you even need to add set analysis for that?

Showing associated data based on selections is Natural behavior you don't need set analysis for that??

If you still need set analysis try using  P ()   , but I must re-iterate this is not required

Example

count({<Occupation = P (Occupation)>}EMPLOYEE_COUNTER)



To concat selections try below in textbox


=$(=chr (39)&concat (distinct fieldname, chr(39)&','&chr(39))&chr(39))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

5 Replies
Anonymous
Not applicable

Hi,

You can try this: (i removed the excess " ")

=count({<Occupation={$(=chr(39)&GetFieldSelections(Occupation,chr(39)&','&chr(39))&chr(39))}>}EMPLOYEE_COUNTER)

vinieme12
Champion III
Champion III

But why do you even need to add set analysis for that?

Showing associated data based on selections is Natural behavior you don't need set analysis for that??

If you still need set analysis try using  P ()   , but I must re-iterate this is not required

Example

count({<Occupation = P (Occupation)>}EMPLOYEE_COUNTER)



To concat selections try below in textbox


=$(=chr (39)&concat (distinct fieldname, chr(39)&','&chr(39))&chr(39))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
VishalWaghole
Specialist II
Specialist II

You can try below expression,

=if(isNull(GetFieldSelections(Occupation)),0,sum(employee_count))

Then try by selecting occupation one by one.

Danny_Langley
Employee
Employee
Author

Thanks so much Vineeth! I knew someone would ask why I even need this because it's natural behavior....ha. I'm going to be working with the Occupation field as a data island to build the filter string to apply elsewhere for a calculation. Anyway, using the P function did the trick and is much simpler! Thanks so much.

Danny_Langley
Employee
Employee
Author

Hi Yddona - thanks for your response - this worked as well. I just needed to remove the " ". It's always the small things that get you!