Accessiblity of $ in when condtion in dataweave?

55 Views Asked by At

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.

1

There are 1 best solutions below

0
On

I found the answer after posting the question!!

it works with braces.

[1,2,5] map ($ when $ >1 otherwise 2)

Thanks

Sushma