Expand my Community achievements bar.

SOLVED

Filter „is included in“ with variable that has a list of values

Avatar

Level 2

Hello

I try to use the filter „is included in“ with a variable like $(vars/@zzz) that in a javascript activity is written like vars.zzz.

It works if I only have one content, but it does not work when I used several contents comma separated like

aaa,bbb,ccc

I also tried the following alternatives without success:

'aaa,bbb,ccc'

'aaa','bbb','ccc'

('aaa,bbb,ccc')

('aaa','bbb','ccc')

Any proposal for solution?

Michael

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Michael,

Yes, it is well-known limitation of the Query,Enrichment, DImension change, etc workflow activities. The wizard code generates this syntax:

IN ('v1,v2,v3')

instead of:
IN ('v1','v2','v3')

clause

given the variable value is: v1,v2,v3

There is no problem with the wizard if the values are typed, only when using variables.

So the only workaround is to replace the Query activity (or Enrichment etc) by a Query def; for instance in a webApp, the webApp var containing a list with values separated by commas, is put in the queryDef where clause as is:

"[XXX/@ID] IN (" + ctx.vars.sTypeList + ")"

Hope it could help.

Regards
J-Serge

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi Michael,

Yes, it is well-known limitation of the Query,Enrichment, DImension change, etc workflow activities. The wizard code generates this syntax:

IN ('v1,v2,v3')

instead of:
IN ('v1','v2','v3')

clause

given the variable value is: v1,v2,v3

There is no problem with the wizard if the values are typed, only when using variables.

So the only workaround is to replace the Query activity (or Enrichment etc) by a Query def; for instance in a webApp, the webApp var containing a list with values separated by commas, is put in the queryDef where clause as is:

"[XXX/@ID] IN (" + ctx.vars.sTypeList + ")"

Hope it could help.

Regards
J-Serge

Avatar

Level 2

Thank you J-Serge,

it helped.

Michael

Avatar

Level 5

Hi Jean-Serge,

What should I do if I have to extract data with this kind of filter (so I cannot use a Query activity) in a CSV file and save it in a AC SFTP folder?

Usually I would use a "Data extraction" activity but this one needs an inbound population.

Could you explain me how to do this?

Thanks in advance,

Salvatore