Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
G3S
Creator III
Creator III

using GetFieldSelections function

Hi,

'Region' has multiple values: Africa, Europe, North East Asia etc.

'SeasonalityTEU_Region' field holds the value. ( grouped at region level in the script load - since each region has multiple 'Origin' )

In the front end, based on the selections made in 'Region, I need for the 'SeasonalityTEU_Region' of each region to be added together.

using the below expression, it works for regions which are a single word, like 'Africa' or 'Europe'. When selection is made with 'North East Asia' for example(or other values which are multiple word string), nothing is returned.

Sum(Aggr({$<Region={$(=GetFieldSelections(Region,','))}>}SeasonalityTEU_Region,Region))

Is the syntax different based on the string value being returned?

thank you

Labels (4)
2 Solutions

Accepted Solutions
UserID2626
Partner - Creator III
Partner - Creator III

Sum({$<Region={$(=chr(39) & Concat(Distinct Region  & chr(39)  ,',' & chr(39)))}>}Measure_Name)

View solution in original post

UserID2626
Partner - Creator III
Partner - Creator III

Try adding same condition for destination in that expression itself.

Sum({$<Region={$(=chr(39) & Concat(Distinct Region  & chr(39)  ,',' & chr(39)))} Destination={$(=chr(39) & Concat(Distinct Destination  & chr(39)  ,',' & chr(39)))}>}Measure_Name)

View solution in original post

6 Replies
SerhanKaraer
Creator III
Creator III

Hello G3S,

The reason is you have spaces in your data and you use it in set expression without quoting. You need to quote each element to overcome this issue.

Sum(Aggr({$<Region={$(=chr(34)&GetFieldSelections(Region,chr(34)&',')&chr(34))}>}SeasonalityTEU_Region,Region))

G3S
Creator III
Creator III
Author

Thank you

Yes, data is string with either single word or multiple words separated by
a space.

*1*. I am not clear on what you mean by quoting each element to overcome
this issue. Could you please explain?

*2*. The expression you shared returns value for single selection. Not for
multiple selections.

I tried adding my initial expression after yours with a +. didn't
work.. (I don't use qlik on an everyday basis. so my set analysis etc is
pretty basic. )

*3*. Could you please adv what adding chr(34) between the field name &
separator in the GetFieldSelections function accomplishes (in bold below)?

------------------------------
Sum(Aggr({$<Region={$(=chr(34)&GetFieldSelections(Region,chr(34)&',')&chr(34))}>}SeasonalityTEU_Region,Region))
------------------------------

appreciate your help please.

UserID2626
Partner - Creator III
Partner - Creator III

Sum({$<Region={$(=chr(39) & Concat(Distinct Region  & chr(39)  ,',' & chr(39)))}>}Measure_Name)

G3S
Creator III
Creator III
Author

thank you @UserID2626 

from user selection, if I have to consider another dimension 'Destination' in addition to the 'Region' , how would the syntax change?

I have multiple regions and multiple destinations. based on each of the below combination, my output needs to change. 

RegionDestination
none selected1 selected
none selectedmultiple selected
1 selected1 selected
1 selectedmultiple selected
multiple selected1 selected
multiple selectedmultiple selected

 

UserID2626
Partner - Creator III
Partner - Creator III

Try adding same condition for destination in that expression itself.

Sum({$<Region={$(=chr(39) & Concat(Distinct Region  & chr(39)  ,',' & chr(39)))} Destination={$(=chr(39) & Concat(Distinct Destination  & chr(39)  ,',' & chr(39)))}>}Measure_Name)

G3S
Creator III
Creator III
Author

thank you @UserID2626  .. that worked 🙂

I now understand the syntax for multiple requirements in set anlysis.. thank you again