Operators in Mule Dataweave
In DataWeave you can carry out
many different operations on the
elements of a DataWeave transform.
Map
• Using Map to Return an Array
• (':array', ':function') ⇒ :array
• Returns an array that is the result of applying
a transformation function (lambda) to each of
the elements. The lambda is invoked with two
parameters: index and the value. If these
parameters are not named, the index is
defined by default as $$ and the value as $
output
• Pluck
• (':object', ':function') ⇒ ':array'
• Pluck is useful for mapping an object into an array.
Pluck is an alternate mapping mechanism to
mapObject. Like mapObject, pluck executes a lambda
over every key:value pair in its processed object, but
instead of returning an object, it returns an array,
which may be built from either the values or the keys
in the object.
• The lambda is invoked with two parameters: key and
the value. If these parameters are not named, the key
is defined by default as $$ and the value as $.
Filter
• Using Filter on an Array
• (':array', ':function') ⇒ ':array'
• Returns an array that only contains those that
pass the criteria specified in the lambda. The
lambda is invoked with two
parameters: index and the value. If these
parameters are not named, the index is
defined by default as $$ and the value as $.
output
Using Filter on an Object
• (':object', ':function') ⇒ ':object'
• Returns an object with the key:value pairs that
pass the acceptance criteria defined in the
lambda. If these parameters are not named,
the index is defined by default as $$ and the
value as $.
output
Remove
• Using Remove on an Array
• (':array', ':name') ⇒ ':array'
• When running it on an array, it returns
another array where the specified indexes are
removed.
Operators in mule dataweave

Operators in mule dataweave

  • 1.
    Operators in MuleDataweave In DataWeave you can carry out many different operations on the elements of a DataWeave transform.
  • 2.
    Map • Using Mapto Return an Array • (':array', ':function') ⇒ :array • Returns an array that is the result of applying a transformation function (lambda) to each of the elements. The lambda is invoked with two parameters: index and the value. If these parameters are not named, the index is defined by default as $$ and the value as $
  • 4.
  • 5.
    • Pluck • (':object',':function') ⇒ ':array' • Pluck is useful for mapping an object into an array. Pluck is an alternate mapping mechanism to mapObject. Like mapObject, pluck executes a lambda over every key:value pair in its processed object, but instead of returning an object, it returns an array, which may be built from either the values or the keys in the object. • The lambda is invoked with two parameters: key and the value. If these parameters are not named, the key is defined by default as $$ and the value as $.
  • 6.
    Filter • Using Filteron an Array • (':array', ':function') ⇒ ':array' • Returns an array that only contains those that pass the criteria specified in the lambda. The lambda is invoked with two parameters: index and the value. If these parameters are not named, the index is defined by default as $$ and the value as $.
  • 8.
  • 9.
    Using Filter onan Object • (':object', ':function') ⇒ ':object' • Returns an object with the key:value pairs that pass the acceptance criteria defined in the lambda. If these parameters are not named, the index is defined by default as $$ and the value as $.
  • 11.
  • 12.
    Remove • Using Removeon an Array • (':array', ':name') ⇒ ':array' • When running it on an array, it returns another array where the specified indexes are removed.