Going through the Dataweaver documentaion Link:https://developer.mulesoft.com/docs/dataweave#_attribute_selector_expressions
Section 3.4 Key Present Trying out the example provide below .
Input:
<users>
<name>Mariano</name>
<name>Luis</name>
<name>Mariano</name>
</users>
Transform:
%dw 1.0
%input payload application/xml
%output application/xml
---
users: payload.users.name[?($ == "Mariano")]
when I try to give this expression in my DataWeaver it gives warning like cannot coerce a:string to a: array:(7,92)
.
Have given the same way mentioned in the document. Could anyone please advice.
Expected Response:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<name>Mariano</name>
<name>Mariano</name>
</users>
Also in the document 1.1.2 string manipulation example wasn't working for me
%dw 1.0
%input payload application/xml
%output application/json
%function words(name) name splitBy " "
---
contacts: payload.users.*user map using (parts = words($.name)){
firstName: parts[0],
(secondName: parts[1]) when (sizeOf parts) > 2,
lastName: parts[-1],
email: "$((lower $.name) replace " " with ".")@acme.com.ar",
address: $.street
}
showing error like multiple marker at this line missing '}' no viable alternative at input email
Started learning and working out the examples provided. Thanks.