I have an input payload [id, name]. Based on this input, I want to loop through each value in the array and form a where clause for my select statement.
Input:
{
"column": ["id","name"]
}
Expected Output:
"id == '123' and name == 'abc'"
With one column I am able to do, but with multiple columns how to iterate and then concatenate?
Assuming you lookup values from another array, you could do something crude like this.
%dw 2.0
output application/json
var values = [2,"test"]
---
payload.column map
{
a: $ ++ " == " ++ "'" ++ values[($$)] ++ "'"
}.a joinBy " and "
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.