Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
peachman
Contributor III
Contributor III

GetfieldSelection() On a Master Measure

Hi All,

I have the following Master Dimension that is calculated as per the below. This is to only make fields starting with XXXX filterable.

IF(LEFT(FIELD,4) = 'xxxx', FIELD,NULL())

 

I then would like to use the GetfieldSelections() Function to identify what one has been selected. Below is what I thought would work. However this returns '-' when I have one valued filtered.

=GetFieldSelections(FIELD,';',1)

 

I have tried putting the Master Dimension Calculation in but this returns nothing as well. 

=GetFieldSelections(IF(LEFT(FIELD,4) = 'xxxx',FIELD,NULL()),';',1)

When I put the Master Dimension next to the field it shows that Master Dimension as selected, but not the field.

 

Any one know a solution to this one?

Labels (2)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You will need to add an Aggr() to your filter to select the actual FIELD.  

Aggr(IF(LEFT(FIELD,4) = 'xxxx', FIELD,NULL()), Field)

If you want to continue to show all the values (unselected in gray) after selections, add Only() with a set like this:

Aggr(IF(LEFT(Only({1}FIELD),4) = 'xxxx', Only({1}FIELD),NULL()), Field)

See https://qlikviewcookbook.com/2016/01/scoping-selections-with-aggr/ for more info.

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

3 Replies
brunobertels
Master
Master

Hi 

by my opinion i should rather add a dimension in the script : 

if(left(field,4)='xxxx',FIELD,NULL) as FIELD2, 

then use GetfieldSelections(FIELD2,';',1) on back end 

 

peachman
Contributor III
Contributor III
Author

I did think of this, but it seems silly that Qlik does this when its build of the field itself. The documentation does not help or explain, and often There are nifty ways to do something.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You will need to add an Aggr() to your filter to select the actual FIELD.  

Aggr(IF(LEFT(FIELD,4) = 'xxxx', FIELD,NULL()), Field)

If you want to continue to show all the values (unselected in gray) after selections, add Only() with a set like this:

Aggr(IF(LEFT(Only({1}FIELD),4) = 'xxxx', Only({1}FIELD),NULL()), Field)

See https://qlikviewcookbook.com/2016/01/scoping-selections-with-aggr/ for more info.

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com