Dataweave

 

How to invoke the Custom Java Class from inside a Dataweave?

Below is the example

%dw 2.0
Import java!com.mycompany::classname
output application/json
---
{
  a: classname::methodName("myString")
}

More info – https://mulesy.com/invoke-custom-java-class-using-dataweave

 

How to access secure property inside Dataweave?

By using p(‘secure::<property name>’) you can access the secure property defined as part of secure property file in mule application

More info – https://mulesy.com/read-properties-in-mule-4

 

How to call Flow from inside a Dataweave?

You can use Dataweave lookup function to call flow from inside a Dataweave It works in Mule apps that are running on Mule Runtime version 4.1.4 and later. It takes the flow’s name and an input payload as parameters. For example, lookup(“flowname”, payload)

 

How to Log message in Dataweave?

Use log(” Current Time Stamp “,now()) function in Dataweave

More info – https://mulesy.com/logging-inside-dataweave-transformation

 

How to use comment line in Dataweave?

// single line comment.

/*
* This is.
* multi-line.
* comments in.
* DataWeave.
*/

 

What is the latest version available for Dataweave?

Dataweave latest version is 2.3, please see the new features in latest Dataweave version https://mulesy.com/latest-features-dataweave-2-3-0

 

How to use map operator in Dataweave?

Please see – https://mulesy.com/map

 

How to use filters in Dataweave?

Please see – https://mulesy.com/filter-in-dataweave-mule-4

 

How to use the Custom Dataweave functions in Mule?

Please see – https://mulesy.com/custom-dwl-function-using-custom-module

 

How you can define a variable in Dataweave?

Please see – https://mulesy.com/variables-in-dataweave

 

How to convert an Object into Array using Data weave?

Use Pluck operator which iterate over an Object and return an array of keys, values, or indices from the object. More info – https://docs.mulesoft.com/mule-runtime/4.3/dw-core-functions-pluck

 

How you will parse an XML with or without namespace in Dataweave? How you will retrieve the attribute value

Please see – https://mulesy.com/xml-processing-in-dataweave

 

Difference between map and mapObject?

map – Iterates over items in an array and outputs the results into a new array.

mapObject – Iterates over an object using a mapper that acts on keys, values, or indices of that object.

From the functionality wise both are same but both work on different input and return different output, where array and object are Java array and Java object.

 

How you can merge two Arrays in Dataweave?

Use flatten operator to merge two array into one – more info – https://docs.mulesoft.com/mule-runtime/4.3/dw-core-functions-flatten

 

How you will convert string into Array and vice versa?

String to Array – https://mulesy.com/convert-string-to-array-in-dataweave-2-0

Array to Stringhttps://mulesy.com/convert-array-to-string

 

What is filter and how we will use it in Dataweave?

Please see – https://mulesy.com/filter-in-dataweave-mule-4

 

How you will do null check in Dataweave?

Please see – https://mulesy.com/perform-null-check-in-mule-4

 

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
TheOtherGuy
TheOtherGuy
8 months ago

For question 6, the answer should be (as of today) v2.3 and not 4.3 . Please correct the typo.