How to create Local variables in Dataweave Mule 4?
Local variables in the Dataweave script are accessible inside the same expression where they are created. We can usually create a local variable to optimize the performance as their scope is within the expression. Local variables in Dataweave can be created using do or using the operator. Let us discuss the local variable creation using "using" operator in Dataweave
Also read: How to use p() function in Dataweave to read property file

Creating local variables by "using" operator
Dataweave Script:
%dw 2.0
output application/xml
---
{
person: using (app='MuleSoft', id='3423', author='Uday') {
app: user,
id: id,
author: author
}
}

0 Comments