Ravindar, Integrations with Mulesoft & BizTalk

Just another Integration blog

Using variables in Dataweave 1.0

Observation Notes:

Case 1: Using just variable name to assign to another field
here declared a variable named “category” with value as “Employee”

%dw 1.0
%output application/java
%var category= "Employee"
--- 
{
   Section: category
}

In the above case, using the just variable name as-is will work. It will assign the value “Employee” to the Section.

Case 2: You want to use the variable value somewhere else code


%dw 1.0
%output application/java
%var category= "Employee"
--- 
{
   Section: category
   Location: payload."$(category)".Name
}

if you notice above, now the variable has been used in double quotest with $ symbol to get the value of the variable “$(category)”

September 23, 2019 - Posted by | Mule 3, Mulesoft

No comments yet.

Leave a comment