Search code examples
dataweavemulesoftmule4

Else if in Dataweave 2.0


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}"),

Solution

  • 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.