0

I have this statement in SAQL q = foreach q generate Region, TerritoryRMA, ContactSysId, PurposeTopic, HasActivityFlag, 'Territory'+\"~~~\"+'Flag' as TFlag; q = filter q by TFlag in {{selection(step_TerritoryFlag)}};

and I would like to have the values of the concatenated fields and text 'Territory'+\"~~~\"+'Flag' in compact filter

['Territory'+\"~~~\"+'Flag',"{{selection(step_TerritoryFlag)}}","in"]

I'm getting an Unknown IDTOKEN: [Territory]," application error.

How can I create this filter in Compact filter?

0

The first few times I tried this I got a similar error. It looks like the issue could be a few different things.

  1. Dimensions used in a concatenation must be a part of that data string. For example in your sample you do not have the 'Territory' or the 'Flag' dimension in your generate clause for "q".
  2. If you are grouping data you will need to include the dimension you want to use in a concatenation as a part of your group clause.
  3. The last thing is that you need to use "{{ single_quote(value(selection(" this tells the program to grab the value from the selection and put single quotes around it so that it is treated like a variable.

Hopefully the example below will help answer your question.

q = load \"Dataset_Name\";
q = foreach q generate 'Territory'+'Flag'+{{ single_quote(value(selection(step_TerritoryFlag))) }} as 'TFlag';
q2 = filter q by 'TFlag' in [...];
q2 = foreach q2 generate 'TFlag' as 'TFlag', sum('measure') as 'sum_measure';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.