Question

Can I use an array variable in a Load Rule with a condition such as CONTAINS?

Answer

Short answer: Yes.

 

Long answer: The JavaScript code generated by Load Rule conditions uses the toString() method which will convert an array to a comma-delimited string. A Load Rule that uses the CONTAINS condition, for example, will convert the variable to a string using toString(), then use indexOf() to find the desired value within the variable.

 

> product_name = ["Nexus One", "Samsung Razor", "Apple iPhone"]
["Nexus One", "Samsung Razor", "Apple iPhone"]

> product_name.toString() "Nexus One,Samsung Razor,Apple iPhone"
> product_name.toString().indexOf("Apple") 24