SlideShare a Scribd company logo
Using the DataWeave Transformer
 In Anypoint Studio, you can place a Transform
Message element in a flow to create transformations
using the DataWeave language.
 The editor helps you do this by offering intelligent
autocomplete suggestions, an output preview that is
updated in real time as you make changes.
 This generates a .dwl transformation file (or several of
them) that stores your code and is packaged with your
Mule application.
 When adding a Transform Message element to a Mule
Flow, it takes the elements from the incoming Mule
Message as its inputs. It then performs the necessary
actions to produce a Mule message as output for the
next element in the flow
 The DataWeave Text Editor GUI
 The Transform Message element allows you to freely
write DataWeave code.
 If you click on an instance of the Transform Message
element in your flow, its properties editor will be
displayed. This editor is divided into three sections:
 Input
 Transform
 Output
Input Section
In the main tab, a tree view shows the known metadata
contents of the incoming Mule Message, allowing you to
explore it and know what data is available for using as an
input, and how to reference each part of it.
If the Mule flow doesn’t expose Metadata about the
elements you need from the incoming message, you can
manually specify it. To do so, select the element of the
input you desire to define, note that the pencil icon at
the top right is no longer grayed out. Click this icon to
open a new tab in your input section where you can
define a sample with the structure of this data.
When the input is of JSON or XML types, the sample input contains plain XML or JSON
code. When the input is of type POJO or DataWeave, the sample input is written
in DataWeave for more simplicity. In these cases the sample DataWeave code is merely a
way to display the sample data, not a transformation in itself.
Setting Reader Parameters
 Some input formats, like CSV, allow you to define a
reader with specific properties that make
DataWeave parse inputs differently. Select the
input element you wish to configure on the tree
view of the input section, then click the gear icon.
Transform Section
 you write the actual DataWeave code that carries out
the transform. Notice that changing the type of your
output directive changes the output section of the
editor. Although DataWeave as a language supports
adding input directives and naming these by any name
you like, in Studio the elements of the input message
are implicitly considered input directives and so they
don’t need to be defined in the header.
If Studio has any metadata about the components that
are upstream or downstream from your Transform
Message element at the time when you add the
component to your flow, a scaffolding for
your DataWeave code is written out automatically, with
as much depth as Studio can intelligently deduce. In
some cases, this code may be enough to carry out the
transformation you need, and no additional coding is
needed. Sometimes, all you need to do is fill in the blank
spaces in the scaffolding with references to the input
fields, other times you may want to carry out more
complex operations that involve aggregation, filtering,
calculations, defining custom functions, etc and there
you must write this out in DataWeave code.
Re-scaffolding Once you’ve added the Transform Message element
to your flow, any further changes you make to the
surrounding message processors and their metadata
won’t affect your `.dw`l file. You may still click the
Scaffolding button on the top left of the DataWeave
properties editor any time you want and have a new
scaffolding built, note that this will erase anything
you’ve written in the DataWeave body. Doing this
won’t affect any directives you defined in your header
(except for the output directive). Use this button if
you’ve made any changes to elements that come after
the Transform Message element on the flow that
expose metadata and don’t mind loosing what you’ve
already written into the transform’s body.
Referencing Existing Transforms
Instead of defining a new .dwl file, you can reference an
existing one by clicking theData Source button,
selecting On File as the source and referencing the
correct file.
Handling Multiple Outputs
A single Transform Message element can give shape to
several different components of the output Mule
message. Each of these output components must be
defined in a separate .dwl file, written out in a separate
tab of the Transform section. For example in one tab you
may be defining the payload contents, in another those
of an outbound property, and these will both be parts of
the same output Mule message
To add a new output, click the Plus sign at the
bottom right of the section:new+output.png[image]
A new tab will then appear, there you can specify
where in the output Mule message to place the
output of this DataWeave transform. In case you’re
creating a new variable or property, you must also
set a name for it.
In the XML editor you can do the same by adding
multiple child elements inside thedw:transform-
message component.
<dw:transform-message>
<dw:set-payload resource="classpath:path/transform.dwl"/> <dw:set-
variable variableName="myVariable"
resource="classpath:path/transform.dwl"/> <dw:set-session-variable
variableName="mySessionVariable"
resource="classpath:path/transform.dwl"/> </dw:transform-message>
Output Section
 This section has two tabs, one of them shows you a neat
expandable tree view of the output data structure, the
other shows you a preview of what the actual output looks
like, built from any sample data you provide in the input
section. As you make changes in the transport section,
notice how the data structure changes. The output of the
transformer is made into the selected component of the
output mule message. If your transformer has multiple
outputs, the Preview tab will display the one
corresponding to the currently selected transform.
Using DataWeave Language
Elsewhere
 All components in Mule that support Mule Expression
Language also support expressions written in DataWeave
Language. To invoke an expression written in DataWeave
language, simply invoke the dw() function, the expression
will return whatever the transform outputs.
 DataWeave expressions defined within this function work
just as those defined within a Transform Message element,
the only difference is that the output is returned into the
expression’s result, wherever it may be.
 For example, you can define a custom object and
populate it with elements from the payload:
 That same expression could be added inside a Logger,
 within a MEL expression, to print out its result:
dw(myobject:{id:payload.accountid, user:payload.user})
#[`dw(myobject:{id:payload.accountid, user:payload.user})`]

More Related Content

What's hot

Responsive Design and Bootstrap
Responsive Design  and BootstrapResponsive Design  and Bootstrap
Responsive Design and Bootstrap
MahmoudOHassouna
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
onlinetrainingplacements
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form material
Rajesh Ch
 
Generic steps in informatica
Generic steps in informaticaGeneric steps in informatica
Generic steps in informatica
Bhuvana Priya
 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
douglascarnicelli
 
Rational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORSRational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORS
GEBS Reporting
 
XLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & TricksXLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & Tricks
guest92a5de
 
Oracle report from ppt
Oracle report from pptOracle report from ppt
Oracle report from ppt
kingshuk_goswami
 
Reports 6i
Reports 6iReports 6i
Reports 6i
Senthamarai B
 
Oracle9i reports developer
Oracle9i reports developerOracle9i reports developer
Oracle9i reports developer
FITSFSd
 
VB6 Using ADO Data Control
VB6 Using ADO Data ControlVB6 Using ADO Data Control
VB6 Using ADO Data Control
Notre Dame of Midsayap College
 
Oracle D2K reports
Oracle D2K reports Oracle D2K reports
Oracle D2K reports
Rajesh Ch
 
d2k
d2kd2k
synopsis
synopsissynopsis
synopsis
jayant parmar
 

What's hot (14)

Responsive Design and Bootstrap
Responsive Design  and BootstrapResponsive Design  and Bootstrap
Responsive Design and Bootstrap
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form material
 
Generic steps in informatica
Generic steps in informaticaGeneric steps in informatica
Generic steps in informatica
 
Oracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and AnswersOracle Certification 1Z0-1041 Questions and Answers
Oracle Certification 1Z0-1041 Questions and Answers
 
Rational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORSRational Publishing Engine with Rational DOORS
Rational Publishing Engine with Rational DOORS
 
XLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & TricksXLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & Tricks
 
Oracle report from ppt
Oracle report from pptOracle report from ppt
Oracle report from ppt
 
Reports 6i
Reports 6iReports 6i
Reports 6i
 
Oracle9i reports developer
Oracle9i reports developerOracle9i reports developer
Oracle9i reports developer
 
VB6 Using ADO Data Control
VB6 Using ADO Data ControlVB6 Using ADO Data Control
VB6 Using ADO Data Control
 
Oracle D2K reports
Oracle D2K reports Oracle D2K reports
Oracle D2K reports
 
d2k
d2kd2k
d2k
 
synopsis
synopsissynopsis
synopsis
 

Viewers also liked

How to use expression filter
How to use expression filterHow to use expression filter
How to use expression filter
Anand kalla
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
Anand kalla
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
Anand kalla
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
Anand kalla
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
Anand kalla
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
Anand kalla
 
Mmc
MmcMmc
Java in Mule
Java in MuleJava in Mule
Java in Mule
Anand kalla
 
Amee - PAPER PRESENTATION ON GAS HANDLING
Amee - PAPER PRESENTATION ON GAS HANDLINGAmee - PAPER PRESENTATION ON GAS HANDLING
Amee - PAPER PRESENTATION ON GAS HANDLING
amee terdue
 
A2 evauation 1
A2 evauation 1A2 evauation 1
A2 evauation 1
Lauren Gilbert
 
1450 – 1750 changes in belief systems
1450 – 1750 changes in belief systems1450 – 1750 changes in belief systems
1450 – 1750 changes in belief systems
Ashley Birmingham
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
RaviShankar Mishra
 
Actividades procesoadministracion 270116
Actividades procesoadministracion 270116Actividades procesoadministracion 270116
Actividades procesoadministracion 270116
johannaAC
 
Mule esb api layer
Mule esb api layerMule esb api layer
Mule esb api layer
Anand kalla
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
AnilKumar Etagowni
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
Anand kalla
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
Anand kalla
 
Mule security saml
Mule security samlMule security saml
Mule security saml
Anand kalla
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
Anand kalla
 

Viewers also liked (20)

How to use expression filter
How to use expression filterHow to use expression filter
How to use expression filter
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
How to use message properties component
How to use message properties componentHow to use message properties component
How to use message properties component
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
Mmc
MmcMmc
Mmc
 
Java in Mule
Java in MuleJava in Mule
Java in Mule
 
Amee - PAPER PRESENTATION ON GAS HANDLING
Amee - PAPER PRESENTATION ON GAS HANDLINGAmee - PAPER PRESENTATION ON GAS HANDLING
Amee - PAPER PRESENTATION ON GAS HANDLING
 
A2 evauation 1
A2 evauation 1A2 evauation 1
A2 evauation 1
 
1450 – 1750 changes in belief systems
1450 – 1750 changes in belief systems1450 – 1750 changes in belief systems
1450 – 1750 changes in belief systems
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
 
Actividades procesoadministracion 270116
Actividades procesoadministracion 270116Actividades procesoadministracion 270116
Actividades procesoadministracion 270116
 
Mule esb api layer
Mule esb api layerMule esb api layer
Mule esb api layer
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
 
FOP_1
FOP_1FOP_1
FOP_1
 
Mule security jaas
Mule security jaasMule security jaas
Mule security jaas
 
Mule security saml
Mule security samlMule security saml
Mule security saml
 
Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
 

Similar to Data weave

Mule data weave
Mule data weaveMule data weave
Mule data weave
D.Rajesh Kumar
 
Data weave
Data weaveData weave
Data weave
Adithya-kuchan
 
Data weave
Data weave Data weave
Data weave
princeirfancivil
 
Data weave
Data weave Data weave
Data weave
Phaniu
 
Data weave
Data weave Data weave
Data weave
mdfkhan625
 
Data weave
Data weave Data weave
Data weave
irfan1008
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
Nagarjuna reddy
 
Dataweave in studio
Dataweave in studioDataweave in studio
Dataweave in studio
Achyuta Lakshmi Puvvala
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
harika thamishetti
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
Son Nguyen
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
Khadhar Koneti
 
Data weave in mule
Data weave in muleData weave in mule
Data weave in mule
Ramakrishna kapa
 
Mule with data weave
Mule with data weaveMule with data weave
Mule with data weave
Son Nguyen
 
Transf from csv to xml
Transf from csv to xmlTransf from csv to xml
Transf from csv to xml
Davide Rapacciuolo
 
2 designer
2 designer2 designer
2 designer
Ravindra Gangwar
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
StrawhatLuffy11
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
D.Rajesh Kumar
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
deepakk073
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
vchircu
 

Similar to Data weave (20)

Mule data weave
Mule data weaveMule data weave
Mule data weave
 
Data weave
Data weaveData weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
 
Dataweave in studio
Dataweave in studioDataweave in studio
Dataweave in studio
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Mca 504 dotnet_unit5
 
Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
 
Data weave documentation
Data weave documentationData weave documentation
Data weave documentation
 
Data weave in mule
Data weave in muleData weave in mule
Data weave in mule
 
Mule with data weave
Mule with data weaveMule with data weave
Mule with data weave
 
Transf from csv to xml
Transf from csv to xmlTransf from csv to xml
Transf from csv to xml
 
2 designer
2 designer2 designer
2 designer
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
 

More from Anand kalla

Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
Anand kalla
 
Java Fundamentals in Mule
Java Fundamentals in MuleJava Fundamentals in Mule
Java Fundamentals in Mule
Anand kalla
 
web services
web servicesweb services
web services
Anand kalla
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
Anand kalla
 
UDDI in Mule Esb
UDDI in Mule EsbUDDI in Mule Esb
UDDI in Mule Esb
Anand kalla
 
WSDL in Mule Esb
WSDL in Mule EsbWSDL in Mule Esb
WSDL in Mule Esb
Anand kalla
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
Anand kalla
 
Mule oracle connectors
Mule oracle connectorsMule oracle connectors
Mule oracle connectors
Anand kalla
 
Mule google connectors
Mule google connectorsMule google connectors
Mule google connectors
Anand kalla
 
Mule execution
Mule executionMule execution
Mule execution
Anand kalla
 
Mule database-connectors
Mule database-connectorsMule database-connectors
Mule database-connectors
Anand kalla
 
Mule batch processing
Mule batch processingMule batch processing
Mule batch processing
Anand kalla
 
Mule architecture
Mule architectureMule architecture
Mule architecture
Anand kalla
 
Mule soap
Mule soapMule soap
Mule soap
Anand kalla
 
Mule soa
Mule soaMule soa
Mule soa
Anand kalla
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
Anand kalla
 
Mule esb
Mule esbMule esb
Mule esb
Anand kalla
 

More from Anand kalla (17)

Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
 
Java Fundamentals in Mule
Java Fundamentals in MuleJava Fundamentals in Mule
Java Fundamentals in Mule
 
web services
web servicesweb services
web services
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
 
UDDI in Mule Esb
UDDI in Mule EsbUDDI in Mule Esb
UDDI in Mule Esb
 
WSDL in Mule Esb
WSDL in Mule EsbWSDL in Mule Esb
WSDL in Mule Esb
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Mule oracle connectors
Mule oracle connectorsMule oracle connectors
Mule oracle connectors
 
Mule google connectors
Mule google connectorsMule google connectors
Mule google connectors
 
Mule execution
Mule executionMule execution
Mule execution
 
Mule database-connectors
Mule database-connectorsMule database-connectors
Mule database-connectors
 
Mule batch processing
Mule batch processingMule batch processing
Mule batch processing
 
Mule architecture
Mule architectureMule architecture
Mule architecture
 
Mule soap
Mule soapMule soap
Mule soap
 
Mule soa
Mule soaMule soa
Mule soa
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
 
Mule esb
Mule esbMule esb
Mule esb
 

Recently uploaded

GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 

Recently uploaded (20)

GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 

Data weave

  • 1.
  • 2. Using the DataWeave Transformer  In Anypoint Studio, you can place a Transform Message element in a flow to create transformations using the DataWeave language.  The editor helps you do this by offering intelligent autocomplete suggestions, an output preview that is updated in real time as you make changes.  This generates a .dwl transformation file (or several of them) that stores your code and is packaged with your Mule application.
  • 3.  When adding a Transform Message element to a Mule Flow, it takes the elements from the incoming Mule Message as its inputs. It then performs the necessary actions to produce a Mule message as output for the next element in the flow
  • 4.  The DataWeave Text Editor GUI  The Transform Message element allows you to freely write DataWeave code.  If you click on an instance of the Transform Message element in your flow, its properties editor will be displayed. This editor is divided into three sections:  Input  Transform  Output
  • 5. Input Section In the main tab, a tree view shows the known metadata contents of the incoming Mule Message, allowing you to explore it and know what data is available for using as an input, and how to reference each part of it. If the Mule flow doesn’t expose Metadata about the elements you need from the incoming message, you can manually specify it. To do so, select the element of the input you desire to define, note that the pencil icon at the top right is no longer grayed out. Click this icon to open a new tab in your input section where you can define a sample with the structure of this data.
  • 6. When the input is of JSON or XML types, the sample input contains plain XML or JSON code. When the input is of type POJO or DataWeave, the sample input is written in DataWeave for more simplicity. In these cases the sample DataWeave code is merely a way to display the sample data, not a transformation in itself.
  • 7. Setting Reader Parameters  Some input formats, like CSV, allow you to define a reader with specific properties that make DataWeave parse inputs differently. Select the input element you wish to configure on the tree view of the input section, then click the gear icon.
  • 8. Transform Section  you write the actual DataWeave code that carries out the transform. Notice that changing the type of your output directive changes the output section of the editor. Although DataWeave as a language supports adding input directives and naming these by any name you like, in Studio the elements of the input message are implicitly considered input directives and so they don’t need to be defined in the header.
  • 9. If Studio has any metadata about the components that are upstream or downstream from your Transform Message element at the time when you add the component to your flow, a scaffolding for your DataWeave code is written out automatically, with as much depth as Studio can intelligently deduce. In some cases, this code may be enough to carry out the transformation you need, and no additional coding is needed. Sometimes, all you need to do is fill in the blank spaces in the scaffolding with references to the input fields, other times you may want to carry out more complex operations that involve aggregation, filtering, calculations, defining custom functions, etc and there you must write this out in DataWeave code.
  • 10. Re-scaffolding Once you’ve added the Transform Message element to your flow, any further changes you make to the surrounding message processors and their metadata won’t affect your `.dw`l file. You may still click the Scaffolding button on the top left of the DataWeave properties editor any time you want and have a new scaffolding built, note that this will erase anything you’ve written in the DataWeave body. Doing this won’t affect any directives you defined in your header (except for the output directive). Use this button if you’ve made any changes to elements that come after the Transform Message element on the flow that expose metadata and don’t mind loosing what you’ve already written into the transform’s body.
  • 11. Referencing Existing Transforms Instead of defining a new .dwl file, you can reference an existing one by clicking theData Source button, selecting On File as the source and referencing the correct file.
  • 12. Handling Multiple Outputs A single Transform Message element can give shape to several different components of the output Mule message. Each of these output components must be defined in a separate .dwl file, written out in a separate tab of the Transform section. For example in one tab you may be defining the payload contents, in another those of an outbound property, and these will both be parts of the same output Mule message
  • 13. To add a new output, click the Plus sign at the bottom right of the section:new+output.png[image] A new tab will then appear, there you can specify where in the output Mule message to place the output of this DataWeave transform. In case you’re creating a new variable or property, you must also set a name for it.
  • 14. In the XML editor you can do the same by adding multiple child elements inside thedw:transform- message component. <dw:transform-message> <dw:set-payload resource="classpath:path/transform.dwl"/> <dw:set- variable variableName="myVariable" resource="classpath:path/transform.dwl"/> <dw:set-session-variable variableName="mySessionVariable" resource="classpath:path/transform.dwl"/> </dw:transform-message>
  • 15. Output Section  This section has two tabs, one of them shows you a neat expandable tree view of the output data structure, the other shows you a preview of what the actual output looks like, built from any sample data you provide in the input section. As you make changes in the transport section, notice how the data structure changes. The output of the transformer is made into the selected component of the output mule message. If your transformer has multiple outputs, the Preview tab will display the one corresponding to the currently selected transform.
  • 16. Using DataWeave Language Elsewhere  All components in Mule that support Mule Expression Language also support expressions written in DataWeave Language. To invoke an expression written in DataWeave language, simply invoke the dw() function, the expression will return whatever the transform outputs.  DataWeave expressions defined within this function work just as those defined within a Transform Message element, the only difference is that the output is returned into the expression’s result, wherever it may be.
  • 17.  For example, you can define a custom object and populate it with elements from the payload:  That same expression could be added inside a Logger,  within a MEL expression, to print out its result: dw(myobject:{id:payload.accountid, user:payload.user}) #[`dw(myobject:{id:payload.accountid, user:payload.user})`]