SlideShare a Scribd company logo
1 of 6
Mule Concepts
DataWeave V
• Variables :
– Constants :
• these can then be referenced as variables in any part of your transform body
– Scoped Variables
• to declare and initialize a variable with a limited scope, you can do so in any part of the
transform’s body
• Constants :
– In the DataWeave header, you define constants as directives
– these can then be referenced as variables in any part of your transform body, just as you
do with input variables.
– Example :
DataWeave – Body -Variables
Transform Output
%dw 1.0
%output application/xml
%var language='Español'
---
{
document: {
language: language,
text: "Hola mundo"
}
}
<?xml version="1.0"
encoding="UTF-8"?>
<document>
<language>Español</language>
<text>Hola Mundo</text>
</document>
• Scoped Variables :
– Variables declared in the Transform’s header always have a global
scope.
– To declare and initialize a variable with a limited scope, you can do so
in any part of the transform’s body.
– You can initialize these variables using :
• literal expressions
• variable reference expressions
• functional expressions
– You cannot reference a variable outside its scope.
– To declare a variable in the DataWeave body, the following syntax is
supported: using (<variable-name> = <expression>)
– It must be written before defining the contents of the literal that it
exists in.
– To reference an already initialized variable, you can just call it by the
name you defined for it as with any other variable
– you can also write it in the form $<variable-name>.
DataWeave – Body -Variables
• Examples :
– Scoped to Simple Value :
– Scoped to Array literal :
DataWeave – Body -Variables
Transform Output
%dw 1.0
%output application/json
---
using (x = 2) 3 + x
Result is simply 5
Transform Output
%dw 1.0
%output application/json
---
using (x = 2) [1, x, 3]
• Examples :
– Scoped to Object literal :
DataWeave – Body -Variables
Transform Comments
%dw 1.0
%output application/xml
---
{
person: using (user = "Greg",
gender = "male") {
name: user,
gender: gender
}
}
user is a valid reference because
it is within the object person for
which it was declared.
• Examples :
– Invalid Reference outside of Scope :
DataWeave – Body -Variables
Transform Comments
%dw 1.0
%output application/xml
---
entry: using (firstName = "Annie",
lastName = "Point") {
person: using (user = firstName,
gender = "male") {
name: user,
gender: gender
},
sn: lastName,
gen: gender
}
The reference lastName is valid
because it is within scope.
The reference gender is invalid
because gender was declared in
the person object, and this
reference exists outside the
scope of that object.

More Related Content

What's hot

Mule with data weave
Mule with data weaveMule with data weave
Mule with data weaveSon Nguyen
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentationSindhu VL
 
Data weave component
Data weave componentData weave component
Data weave componentSindhu VL
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Databaseakashdprajapati
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentationKhadhar Koneti
 
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its ModuleMuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its ModuleJitendra Bafna
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in muleSindhu VL
 
Integrate with database by groovy
Integrate with database by groovyIntegrate with database by groovy
Integrate with database by groovySon Nguyen
 
Mule xml transformation
Mule xml transformationMule xml transformation
Mule xml transformationD.Rajesh Kumar
 
Mule expression component
Mule expression componentMule expression component
Mule expression componentKarnam Karthik
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshStrawhatLuffy11
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in muleKhan625
 
MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64akashdprajapati
 
Stored Procedure With In Out Parameters in Mule 3.6
 Stored Procedure With In Out Parameters in Mule 3.6 Stored Procedure With In Out Parameters in Mule 3.6
Stored Procedure With In Out Parameters in Mule 3.6Sashidhar Rao GDS
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo javeed_mhd
 

What's hot (20)

Mule with data weave
Mule with data weaveMule with data weave
Mule with data weave
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
 
Data weave component
Data weave componentData weave component
Data weave component
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
 
Passing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flowPassing java arrays in oracle stored procedure from mule esb flow
Passing java arrays in oracle stored procedure from mule esb flow
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
 
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its ModuleMuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in mule
 
Integrate with database by groovy
Integrate with database by groovyIntegrate with database by groovy
Integrate with database by groovy
 
Mule xml transformation
Mule xml transformationMule xml transformation
Mule xml transformation
 
Mule expression component
Mule expression componentMule expression component
Mule expression component
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
 
MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64
 
Stored Procedure With In Out Parameters in Mule 3.6
 Stored Procedure With In Out Parameters in Mule 3.6 Stored Procedure With In Out Parameters in Mule 3.6
Stored Procedure With In Out Parameters in Mule 3.6
 
Using XSLT in Mule
Using XSLT in MuleUsing XSLT in Mule
Using XSLT in Mule
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
 
Refreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notificationRefreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notification
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule jdbc
Mule   jdbcMule   jdbc
Mule jdbc
 

Viewers also liked

Mule scopes foreach_scope
Mule scopes foreach_scopeMule scopes foreach_scope
Mule scopes foreach_scopekunal vishe
 
Collection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESBCollection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESBKiran Boddepalli
 
Mule data weave_4
Mule data weave_4Mule data weave_4
Mule data weave_4kunal vishe
 
Mule data weave_8
Mule data weave_8Mule data weave_8
Mule data weave_8kunal vishe
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traceskunal vishe
 
Mule concepts transformers
Mule concepts transformersMule concepts transformers
Mule concepts transformerskunal vishe
 
Mule esb-connectors
Mule esb-connectorsMule esb-connectors
Mule esb-connectorshimajareddys
 
Mule debugging logging_configuration_in_mule
Mule debugging logging_configuration_in_muleMule debugging logging_configuration_in_mule
Mule debugging logging_configuration_in_mulekunal vishe
 
Mulethenewtechnology 12549172699166-phpapp03-160421133841
Mulethenewtechnology 12549172699166-phpapp03-160421133841Mulethenewtechnology 12549172699166-phpapp03-160421133841
Mulethenewtechnology 12549172699166-phpapp03-160421133841ppts123456
 
Mule concepts connectors
Mule concepts connectorsMule concepts connectors
Mule concepts connectorskunal vishe
 
Mule concepts filters scopes_routers
Mule concepts filters scopes_routersMule concepts filters scopes_routers
Mule concepts filters scopes_routerskunal vishe
 
Mule Custom Aggregator
Mule Custom AggregatorMule Custom Aggregator
Mule Custom AggregatorAnkush Sharma
 
Summer School: Achievements and Applications of Contemporary Informatics, Mat...
Summer School: Achievements and Applications of Contemporary Informatics, Mat...Summer School: Achievements and Applications of Contemporary Informatics, Mat...
Summer School: Achievements and Applications of Contemporary Informatics, Mat...YSF-2015
 
Mule concepts elements in a mule flow
Mule concepts elements in a mule flowMule concepts elements in a mule flow
Mule concepts elements in a mule flowkunal vishe
 
Mule debugging logging_in_mule
Mule debugging logging_in_muleMule debugging logging_in_mule
Mule debugging logging_in_mulekunal vishe
 
Mule error handling_rollback exception strategy
Mule error handling_rollback exception strategyMule error handling_rollback exception strategy
Mule error handling_rollback exception strategykunal vishe
 
Mule concepts flows
Mule concepts flowsMule concepts flows
Mule concepts flowskunal vishe
 

Viewers also liked (20)

Mule scopes foreach_scope
Mule scopes foreach_scopeMule scopes foreach_scope
Mule scopes foreach_scope
 
Collection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESBCollection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESB
 
Mule data weave_4
Mule data weave_4Mule data weave_4
Mule data weave_4
 
Mule data weave_8
Mule data weave_8Mule data weave_8
Mule data weave_8
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traces
 
Mule scopes 2
Mule scopes 2Mule scopes 2
Mule scopes 2
 
Mule concepts transformers
Mule concepts transformersMule concepts transformers
Mule concepts transformers
 
Mule esb-connectors
Mule esb-connectorsMule esb-connectors
Mule esb-connectors
 
Mule mel 1
Mule mel 1Mule mel 1
Mule mel 1
 
Mule scopes 1
Mule scopes 1Mule scopes 1
Mule scopes 1
 
Mule debugging logging_configuration_in_mule
Mule debugging logging_configuration_in_muleMule debugging logging_configuration_in_mule
Mule debugging logging_configuration_in_mule
 
Mulethenewtechnology 12549172699166-phpapp03-160421133841
Mulethenewtechnology 12549172699166-phpapp03-160421133841Mulethenewtechnology 12549172699166-phpapp03-160421133841
Mulethenewtechnology 12549172699166-phpapp03-160421133841
 
Mule concepts connectors
Mule concepts connectorsMule concepts connectors
Mule concepts connectors
 
Mule concepts filters scopes_routers
Mule concepts filters scopes_routersMule concepts filters scopes_routers
Mule concepts filters scopes_routers
 
Mule Custom Aggregator
Mule Custom AggregatorMule Custom Aggregator
Mule Custom Aggregator
 
Summer School: Achievements and Applications of Contemporary Informatics, Mat...
Summer School: Achievements and Applications of Contemporary Informatics, Mat...Summer School: Achievements and Applications of Contemporary Informatics, Mat...
Summer School: Achievements and Applications of Contemporary Informatics, Mat...
 
Mule concepts elements in a mule flow
Mule concepts elements in a mule flowMule concepts elements in a mule flow
Mule concepts elements in a mule flow
 
Mule debugging logging_in_mule
Mule debugging logging_in_muleMule debugging logging_in_mule
Mule debugging logging_in_mule
 
Mule error handling_rollback exception strategy
Mule error handling_rollback exception strategyMule error handling_rollback exception strategy
Mule error handling_rollback exception strategy
 
Mule concepts flows
Mule concepts flowsMule concepts flows
Mule concepts flows
 

Similar to Mule data weave_5 (20)

Placement and variable 03 (js)
Placement and variable 03 (js)Placement and variable 03 (js)
Placement and variable 03 (js)
 
Data weave (MuleSoft)
Data weave (MuleSoft)Data weave (MuleSoft)
Data weave (MuleSoft)
 
Js datatypes
Js datatypesJs datatypes
Js datatypes
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
 
c-functions.ppt
c-functions.pptc-functions.ppt
c-functions.ppt
 
c-functions.ppt
c-functions.pptc-functions.ppt
c-functions.ppt
 
c-functions.ppt
c-functions.pptc-functions.ppt
c-functions.ppt
 
Introduction to Visual Basic
Introduction to Visual Basic Introduction to Visual Basic
Introduction to Visual Basic
 
Chapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.pptChapter Introduction to Modular Programming.ppt
Chapter Introduction to Modular Programming.ppt
 
Data weave
Data weaveData weave
Data weave
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
 
Data weave
Data weave Data weave
Data weave
 
Dataweave
Dataweave Dataweave
Dataweave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Java script
Java scriptJava script
Java script
 
Data structure scope of variables
Data structure scope of variablesData structure scope of variables
Data structure scope of variables
 
Ma3696 Lecture 3
Ma3696 Lecture 3Ma3696 Lecture 3
Ma3696 Lecture 3
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02
 

More from kunal vishe

Mule scopes request_response_scope
Mule scopes request_response_scopeMule scopes request_response_scope
Mule scopes request_response_scopekunal vishe
 
Mule scopes async_scope
Mule scopes async_scopeMule scopes async_scope
Mule scopes async_scopekunal vishe
 
Mule error handling_choice exception strategy
Mule error handling_choice exception strategyMule error handling_choice exception strategy
Mule error handling_choice exception strategykunal vishe
 
Mule concepts exception strategies
Mule concepts exception strategiesMule concepts exception strategies
Mule concepts exception strategieskunal vishe
 
Mule concepts components
Mule concepts componentsMule concepts components
Mule concepts componentskunal vishe
 

More from kunal vishe (9)

Mule mel 4_tips
Mule mel 4_tipsMule mel 4_tips
Mule mel 4_tips
 
Mule mel 3
Mule mel 3Mule mel 3
Mule mel 3
 
Mule mel 2
Mule mel 2Mule mel 2
Mule mel 2
 
Mule scopes request_response_scope
Mule scopes request_response_scopeMule scopes request_response_scope
Mule scopes request_response_scope
 
Mule scopes async_scope
Mule scopes async_scopeMule scopes async_scope
Mule scopes async_scope
 
Mule message
Mule messageMule message
Mule message
 
Mule error handling_choice exception strategy
Mule error handling_choice exception strategyMule error handling_choice exception strategy
Mule error handling_choice exception strategy
 
Mule concepts exception strategies
Mule concepts exception strategiesMule concepts exception strategies
Mule concepts exception strategies
 
Mule concepts components
Mule concepts componentsMule concepts components
Mule concepts components
 

Recently uploaded

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Recently uploaded (20)

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

Mule data weave_5

  • 2. • Variables : – Constants : • these can then be referenced as variables in any part of your transform body – Scoped Variables • to declare and initialize a variable with a limited scope, you can do so in any part of the transform’s body • Constants : – In the DataWeave header, you define constants as directives – these can then be referenced as variables in any part of your transform body, just as you do with input variables. – Example : DataWeave – Body -Variables Transform Output %dw 1.0 %output application/xml %var language='Español' --- { document: { language: language, text: "Hola mundo" } } <?xml version="1.0" encoding="UTF-8"?> <document> <language>Español</language> <text>Hola Mundo</text> </document>
  • 3. • Scoped Variables : – Variables declared in the Transform’s header always have a global scope. – To declare and initialize a variable with a limited scope, you can do so in any part of the transform’s body. – You can initialize these variables using : • literal expressions • variable reference expressions • functional expressions – You cannot reference a variable outside its scope. – To declare a variable in the DataWeave body, the following syntax is supported: using (<variable-name> = <expression>) – It must be written before defining the contents of the literal that it exists in. – To reference an already initialized variable, you can just call it by the name you defined for it as with any other variable – you can also write it in the form $<variable-name>. DataWeave – Body -Variables
  • 4. • Examples : – Scoped to Simple Value : – Scoped to Array literal : DataWeave – Body -Variables Transform Output %dw 1.0 %output application/json --- using (x = 2) 3 + x Result is simply 5 Transform Output %dw 1.0 %output application/json --- using (x = 2) [1, x, 3]
  • 5. • Examples : – Scoped to Object literal : DataWeave – Body -Variables Transform Comments %dw 1.0 %output application/xml --- { person: using (user = "Greg", gender = "male") { name: user, gender: gender } } user is a valid reference because it is within the object person for which it was declared.
  • 6. • Examples : – Invalid Reference outside of Scope : DataWeave – Body -Variables Transform Comments %dw 1.0 %output application/xml --- entry: using (firstName = "Annie", lastName = "Point") { person: using (user = firstName, gender = "male") { name: user, gender: gender }, sn: lastName, gen: gender } The reference lastName is valid because it is within scope. The reference gender is invalid because gender was declared in the person object, and this reference exists outside the scope of that object.