I am trying to write else if statement in my Data weave but getting the error expression missing ""

PBSI__Tax_Code__c : if((payload.order.customer."billing-address"."country-code" =="NL") "${sf_taxcode}" else if(payload.order.customer."billing-address"."country-code" =="DE") "${sf_deTaxcode}"), 

2 Answers

The expression is missing the else of the last if sentence. It is mandatory to have an else.

As a simplified example:

{ PBSI__Tax_Code__c: if(country_code =="NL") "something" else if(country_code =="DE") "something" else "something else" } 

Also note that it in DataWeave configuration properties are accessed with the p() function.

%dw 2.0 output application/json --- { PBSI__Tax_Code__c : if(payload.order.customer."billing-address"."country-code" =="NL") p('sf_taxcode') else if(payload.order.customer."billing-address"."country-code" =="DE") p('sf_deTaxcode') else "as default" } 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.