I have one requirement where entire response structure will be varied based on the current element. but in dataweave $ is not accessible with when, but with function it is accessible. Could you please suggest am i missing some thing here?
[1,2,5] map $ when $ > 1 otherwise 2
throws error. but same used like the below way works.
%function r(a) a when a > 1 otherwise 2
---
[1,2,5] map r($)
Could you please help me to understand the behaviour.
Thanks
Sushma.
I found the answer after posting the question!!
it works with braces.
Thanks
Sushma