maomifadacai
maomifadacai

Reputation: 369

handle if else in dataweave

I want use if-else to handle show an item when the value is not null. when vars.request-id != null or not isEmpty(vars.request-id) output {requestID:"" ,origin_uri:"", errorDesc: ""}

when vars.request-id == null or isEmpty(vars.request-id) output {origin_uri:"", errorDesc: ""}

but the following code is Unable to resolve

{
   requestID : ("Midend-correlation-id": vars.request-id) if (vars.request-id != null) 
   origin_uri: vars.errorContent.uri
   errorDesc: vars.errorContent.message
}

Upvotes: 0

Views: 252

Answers (1)

Salim Khan
Salim Khan

Reputation: 4303

Is this what you are after? I am not very clear on the ask and from what i understand i tried to scribble something for you. Maybe a clear input , some condition and the expected output would help..

enter image description here

enter image description here

Upvotes: 1

Related Questions