Articles

Dataweave Interview Question Using Map and Reduce

This article will help you practice your Dataweave skills in Mulesoft. Here we have to convert the input to a specific type of output. Let’s get started.

Input:

Source de l’article sur DZONE

MuleSoft for Beginners – Mule 4 Development (Complete Series )

Hey Guys

These are below 10 videos that help you to learn MuleSoft Development Hands-on!

Source de l’article sur DZONE

Implement a Counter in Dataweave 2.x and Above

Implement a Counter in Dataweave

These days, I see quite a few posts that require using Counter in DataWeave. The problem faced is that users require a Sequence Number that is consistent throughout the different sections of data. Consider the below JSON:

JSON

xxxxxxxxxx
1

17

 

1

[{

2

"Item" : "ItemXYZ",

3

  "SequenceNo" : 1,

4

  "Parts": [

5

{ "Part" : "A1", "SequenceNo" : 2 }, { "Part" : "B1", "SequenceNo" : 3 },

6

{ "Part" : "A2", "SequenceNo" : 4 }, { "Part" : "B2", "SequenceNo" : 5 }

7

 ]

8

},

9

 {

10

"Item" : "ItemRTY",

11

  "SequenceNo" : 6,

12

  "Parts": [

13

{ "Part" : "A1", "SequenceNo" : 7 }, { "Part" : "B1", "SequenceNo" : 8 },

14

{ "Part" : "A2", "SequenceNo" : 9 }, { "Part" : "B2", "SequenceNo" : 10 }

15

 ]

16

}

17

]

Source de l’article sur DZONE

Mule 4: Creating Global Custom Functions in Dataweave 2.0

In this article, I will explain how to create a global function that can be access or reuse by other Transform Message Component within a Mule Application.

First, We need to create a Dataweave File (.dwl) and save it in src/main/resources/modules/. Now,we can define our global custom functions here by using the fun directive and global variable by using var directive. Also note thatthis dwl file should not contain an output directory, body expression, or the separator (—) between header and body sections.

Source de l’article sur DZONE