Contact Us 1-800-596-4880

Core (dw::Core)

This module contains core DataWeave functions for data transformations. It is automatically imported into any DataWeave script. For documentation on DataWeave 1.0 functions, see DataWeave Operators.

Functions

Name Description

++

Concatenates two values.

--

Removes specified values from an input value.

abs

Returns the absolute value of a number.

avg

Returns the average of numbers listed in an array.

ceil

Rounds a number up to the nearest whole number.

contains

Returns true if an input contains a given value, false if not.

daysBetween

Returns the number of days between two dates.

distinctBy

Iterates over an array and returns the unique elements in it.

endsWith

Returns true if a string ends with a provided substring, false if not.

entriesOf

Returns an array of key-value pairs that describe the key, value, and any attributes in the input object.

filter

Iterates over an array and applies an expression that returns matching values.

filterObject

Iterates a list of key-value pairs in an object and applies an expression that returns only matching objects, filtering out the rest from the output.

find

Returns indices of an input that match a specified value.

flatMap

Iterates over each item in an array and flattens the results.

flatten

Turns a set of subarrays (such as [ [1,2,3], [4,5,[6]], [], [null] ]) into a single, flattened array (such as [ 1, 2, 3, 4, 5, [6], null ]).

floor

Rounds a number down to the nearest whole number.

groupBy

Returns an object that groups items from an array based on specified criteria, such as an expression or matching selector.

isBlank

Returns true if the given string is empty or completely composed of whitespace, false if not.

isDecimal

Returns true if the given number contains a decimal, false if not.

isEmpty

Returns true if the given input value is empty, false if not.

isEven

Returns true if the number or numeric result of a mathematical operation is even, false if not.

isInteger

Returns true if the given number is an integer (which lacks decimals), false if not.

isLeapYear

Returns true if it receives a date for a leap year, false if not.

isOdd

Returns true if the number or numeric result of a mathematical operation is odd, false if not.

joinBy

Merges an array into a single string value and uses the provided string as a separator between each item in the list.

keysOf

Returns an array of keys from key-value pairs within the input object.

log

Without changing the value of the input, log returns the input as a system log.

lower

Returns the provided string in lowercase characters.

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.

match

Uses a Java regular expression (regex) to match a string and then separates it into capture groups. Returns the results in an array.

matches

Checks if an expression matches the entire input string.

max

Returns the highest Comparable value in an array.

maxBy

Iterates over an array and returns the highest value of Comparable elements from it.

min

Returns the lowest Comparable value in an array.

minBy

Iterates over an array to return the lowest value of comparable elements from it.

mod

Returns the modulo (the remainder after dividing the dividend by the divisor).

namesOf

Returns an array of strings with the names of all the keys within the given object.

native

Internal method used to indicate that a function implementation is not written in DataWeave but in Scala.

now

Returns a DateTime value for the current date and time.

orderBy

Reorders the elements of an input using criteria that acts on selected elements of that input.

pluck

Useful for mapping an object into an array, pluck iterates over an object and returns an array of keys, values, or indices from the object.

pow

Raises the value of a base number to the specified power.

random

Returns a pseudo-random number greater than or equal to 0.0 and less than 1.0.

randomInt

Returns a pseudo-random whole number from 0 to the specified number (exclusive).

read

Reads a string or binary and returns parsed content.

readUrl

Similar to the read function. However, readURL accepts a URL, including a classpath-based URL.

reduce

Applies a reduction expression to the elements in an array.

replace

Performs string replacement.

round

Rounds a number up or down to the nearest whole number.

scan

Returns an array with all of the matches found in an input string.

sizeOf

Returns the number of elements in an array. It returns 0 if the array is empty.

splitBy

Splits a string into a string array based on a value that matches part of that string. It filters out the matching part from the returned array.

sqrt

Returns the square root of a number.

startsWith

Returns true or false depending on whether the input string starts with a matching prefix.

sum

Returns the sum of numeric values in an array.

to

Returns a range with the specified boundaries.

trim

Removes any blank spaces from the beginning and end of a string.

typeOf

Returns the type of a value.

unzip

Performs the opposite of zip. It takes an array of arrays as input.

upper

Returns the provided string in uppercase characters.

uuid

Returns a v4 UUID using random numbers as the source.

valuesOf

Returns an array of the values from key-value pairs in an object.

with

When used with replace, with passes a replacement string.

write

Writes a value as a string or binary in a supported format.

xsiType

Creates a xsi:type type attribute. This method returns an object, so it must be used with dynamic attributes.

zip

Merges elements from two arrays into an array of arrays.

Types

Namespaces

Annotations