Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How do we pass more than one value(array) of values from a variable into a filter condition of subsequent query activity

Avatar

Level 1

Hello,

 

Can we pass multiple values from a variable in JavaScript activity into filter criteria of subsequent query activity.

Tried using "is Included in" but all the values from Variable are being read as single value inside the filter criteria of query activity.

How can we have read all them separately, any suggestions appreciated !

 

doncic_0-1581101539200.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

Can you try the below code once?

 

var id = []
var res = query.getElementsByTagName("{{schema name}}")
for each (var w in res){
id.push("'"+w.getAttribute("attribute name")+"'");
}
vars.idArray = id.join(",").slice(1,-1);
logInfo(vars.idArray);

 

 

if it is a string that is in filter criteria should use $noescaping(vars/@idArray) in it.

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi,

 

Can you try the below code once?

 

var id = []
var res = query.getElementsByTagName("{{schema name}}")
for each (var w in res){
id.push("'"+w.getAttribute("attribute name")+"'");
}
vars.idArray = id.join(",").slice(1,-1);
logInfo(vars.idArray);

 

 

if it is a string that is in filter criteria should use $noescaping(vars/@idArray) in it.

 

Avatar

Level 2

Hi,

You can define your variables in two(or more) separate variables in javscript activity and then in query activity use two(or more) different conditions with OR operator(separate condition for every variable with same column of table). I think this should work if i understood it correctly.

 

Regards