- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog TLC Blog
- Support Desk Support Desk
Can I use an array variable in a Load Rule with a condition such as CONTAINS?
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
Copyright All Rights Reserved © 2008-2021