Contact Us 1-800-596-4880

Supported Data Types and Formulas

In MuleSoft Composer, the following data types and formulas are supported:

Data Types

The value that a Composer field can accept for a value is a data type. In Composer, the following data types are available:

Data Type Definition

Boolean

Evaluates to true or false.

Date

Stores a year, month, and day as yyyy-MM-dd.

DateTime

Stores a date and time within a time zone relative to Coordinated Universal Time (UTC). Composer does not store the user’s local timezone; therefore, when a DateTime value is entered in this field, Composer assumes that the DateTime value entered is in UTC format. A time zone must include either the symbol + in the time value or the symbol - in the date value. For example, 12:30 p.m. on June 1, 2019, in the Macau time zone is represented as 2019-06-01T12:30:00+08:00. Note that when using the today() function, the value for Date is returned in UTC. Additionally, if the date is not entered in UTC, Composer will automatically convert the date to UTC format which may or may not be accurate for the user’s local time zone which could affect the resulting logic.

List<Object>

Returns a list of objects, for example, the output of the Get Records action.

List<Primitive>

Returns a list containing primitive data types. The following item data types are available: Boolean, Date, DateTime, Integer, Number, and String.

Number

Stores either a floating-point number in the range of 1.40129846432481707e-45 to 3.40282346638528860e+38 or an integer.

Object

Refers to a composite data type that can contain other data types as properties (boolean, date, number, and so on).

String

Stores text, numbers that are not number data types, or a combination of both, for example, 94u0sfjlk*(f!`lkkjd, 18005555555, or Fred.

String Functions

The Custom Expression Editor supports the following string formulas and operators:

Function Name Description Example Parameter Definition Input Data Type Parameters Output Data Type

lower

Returns the provided string in lowercase characters.

lower(COMPOSER) = composer

NA

text: String

String

upper

Returns the provided string in uppercase characters.

upper(composer) = COMPOSER

NA

text: String

String

capitalize

Capitalizes the first letter of each word in a string. This also removes underscores between words and puts a space before each capitalized word.

capitalize(name) = Name

capitalize(firstName) = First Name

capitalize(customer_first_name) = Customer First Name

NA

text: String

String

trim

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

trim(<long example text>) = this example long text

NA

text: String

String

first

Returns the specified number of characters from the beginning of a string. If the number is equal to or greater than the number of characters in the string, the function returns the entire string.

first(Hello Composer!, 5) = Hello

NA

text: String

numCharacters: Number

String

last

Returns the specified number of characters from the end of a string.

last(Hello Composer!, 9) = Composer!

NA

text: String

numCharacters: Number

String

substitute

Replaces all substrings that match a literal search string with a specified replacement string. Replacement proceeds from the beginning of the string to the end. For example, the result of replacing aa with b in the string aaa is ba, rather than ab.

substitute(Composer, o, O) = COmpOser

substitute(Composer, a, Example) = Composer

NA

text: String

target: String

replacement: String

String

fromStringToBoolean

Transforms a string input value into a boolean value.

fromStringToBoolean(true) = true

fromStringToBoolean(FALSE) = false

fromStringToBoolean(TrUe) = true

NA

text: String

Boolean

fromStringToDate

Transforms a string input value into a date value. Accepts a format and locale. The format parameter represents the format of the input string.

The default format is uuuu-MM-dd and the default locale is en-US; however, these defaults can be modified.

fromStringToDate(2021-03-15, uuuu-MM-dd, en-US) = 2021-03-15

fromStringToDate(2021/15/03, uuuu/dd/MM, en-US) = 2021-03-15

Format: The format parameter represents the format of the input string. This parameter accepts Java character patterns based on ISO-8601. A Date value, such as 2011-12-03, has the format uuuu-MM-dd.

Locale: Optional ISO 3166 country code to use, such as en-US, AR, or ES.

text: String

format: String

locale: String

Date

fromStringToDateTime

Transforms a string input value into a dateTime value. Accepts a format and locale. The format parameter represents the format of the input string. The default format is uuuu-MM-dd’T’HH:mm:ssz and the default locale is en-US; however, these defaults can be modified.

fromStringToDateTime(2021-03-15T23:57:59Z,uuuu-MM-dd’T’HH:mm:ssz,US) = 2021-03-15T23:57:59Z

fromStringToDateTime(2021-03-15 23:57:59Z,uuuu-MM-dd HH:mm:ssz,en-US) = 2021-03-15T23:57:59Z

Format: The format parameter represents the format of the input string. This parameter accepts Java character patterns based on ISO-8601. A DateTime value, such as 2011-12-03T10:15:30.000000+01:00, has the format uuuu-MM-dd HH:mm:ssz.

Locale: Optional ISO 3166 country code to use, such as en-US, AR, or ES.

text: String

format: String
locale: String

DateTime

fromStringToNumber

Transforms a string input value into a number value.

fromStringToNumber(1) = 1

fromStringToNumber(0.05) = 0.05

NA

text: String

Number

emptyString

Returns an empty string.

You can use the emptyString function wherever an empty string is needed, including as an input parameter in other functions.

-

-

String

substring

Returns a substring that spans from the character at the specified from index to the last character before the until index.

substring(Hello Composer, 6, 14) = Composer

N/A

text: String from: Number until: Number

String

It is important to note that in a string field, you can use number expressions selected from the operator list; however, the expressions must be enclosed within parentheses. For example, you can enter abc(9+9) where the + is selected from the operator list. This string renders as abc18.

Number Functions

In the Custom Expression Editor, a mathematical operator (+,-,*, or /) selected from the operator list is different from an operator typed and resolved as a string character. For example, the entry 9+9 is considered a string rather than 18. To use mathematical operators, select them from the operator list or type and select them using the Enter key, Tab key, or mouse with typeahead.

The Custom Expression Editor supports the following number formulas and operators:

Function Name Description Example Parameter Definition Input Data Type Parameters Output Data Type

round

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

round(1.2) = 1

round(4.6) = 5

round(3.5) = 4

NA

number: Number

Number

ceil

Rounds a number up to the nearest whole number.

ceil(1.2) = 2

ceil(3) = 3

NA

number: Number

Number

floor

Rounds a number down to the nearest whole number.

floor(2.2) = 2

floor(3) = 3

NA

number: Number

Number

abs

Returns the absolute value of a number.

abs(-3.4) = 3.4

abs(2) = 2

NA

number: Number

Number

fromNumberToString

Transforms a number value (whole or decimal) into a string value.

fromNumberToString(1) = 1

fromNumberToString(0.05) = 0.05

NA

number: Number

String

fromNumberToDateTime

Transforms a number input value into a dateTime value. Uses milliseconds or seconds as the unit. The default unit is seconds.

fromDateTimeToNumber(1443743879, seconds) = 2015-10-01T23:57:59Z

fromDateTimeToNumber(1443743879000, milliseconds) = 2015-10-01T23:57:59Z

Unit: The unit of time to use for the conversion: "milliseconds" or "seconds". The default unit is "seconds."

unit: String

DateTime

Date Functions

In the Custom Expression Editor, date and dateTime data pills can only be used as inputs. You cannot enter the dates manually.

Note that Composer does not store the user’s local timezone; therefore, when a value is entered in a DateTime field, Composer assumes that the DateTime value entered is in UTC format. A time zone must include either the symbol + in the time value or the symbol - in the date value. For example, 12:30 p.m. on June 1, 2019, in the Macau time zone is represented as 2019-06-01T12:30:00+08:00. Additionally, if the date is not entered in UTC, Composer will automatically convert the date to UTC format which may or may not be accurate for the user’s local time zone which could affect the resulting logic.

The Custom Expression Editor supports the following date and dateTime formulas and operators:

Function Name Description Example Parameter Definition Input Data Type Parameters Output Data Type

today

Returns the date for today as a Date type.

today() = 2021-03-15

NA

NA

Date

now

Returns a DateTime value for the current date and time.

now() = 2021-03-15T18:23:20

NA

NA

DateTime

addDays

Creates and returns a Date value incremented or decremented by the specified number of days.

addDays(today(), 3) = 2021-03-18

addDays(2021-03-15, -4) = 2021-03-11

NA

date: Date

numDays: number

Date

addDays

Creates and returns a DateTime value incremented or decremented by the specified number of days.

addDays(now(), 3) = 2021-03-18T18:23:20

addDays(2021-03-15T18:23:20, 3) = 2021-03-18T18:23:20

NA

dateTime: DateTime

numDays: number

DateTime

addMonths

Creates and returns a Date value incremented or decremented by the specified number of months.

addMonths(today(), 3) = 2021-06-15

addMonths(2021-03-15, -4) = 2020-12-15

NA

date: Date

numMonths: number

Date

addMonths

Creates and returns a DateTime value incremented or decremented by the specified number of months.

addMonths(now(), 3) = 2021-06-15T18:23:20

addMonths(2021-03-15T18:23:20, -4) = 2020-12-15T18:23:20

NA

dateTime: DateTime

numMonths: number

DateTime

addYears

Creates and returns a Date value incremented or decremented by the specified number of years.

addYears(today(), 1) = 2022-03-15

addYears(2021-03-15, -1) = 2020-03-15

NA

date: Date

numYears: number

Date

addYears

Creates and returns a DateTime value incremented or decremented by the specified number of years.

addYears(now(), 3) = 2024-03-15T18:23:20

addYears(2021-03-15T18:23:20, -1) = 2020-03-15T18:23:20

NA

dateTime: DateTime

numYears: number

DateTime

addHours

Creates and returns a DateTime value incremented or decremented by the specified number of hours.

addHours(now(), 1) = 2021-03-15T23:23:20

addHours(2021-03-15T22:23:20, 3) = 2021-03-16T01:23:20

addHours(2021-03-15T22:23:20, -4) = 2021-03-15T18:23:20

NA

dateTime: DateTime

numHours: number

DateTime

addMinutes

Creates and returns a DateTime value incremented or decremented by the specified number of minutes.

addMinutes(now(), 5) = 2021-03-15T18:33:20

addMinutes(2021-03-15T23:45:00,15) = 2021-03-16T00:00:00

addMinutes(2021-03-15T18:23:20, -30) = 2021-03-15T17:53:20

NA

dateTime: DateTime

numMinutes: number

DateTime

addSeconds

Creates and returns a DateTime value incremented or decremented by the specified number of seconds.

addSeconds(now(), 30) = 2021-03-15T18:23:50

addSeconds(2021-03-15T23:45:00,15) = 2021-03-15T23:45:30

addSeconds(2021-03-15T18:23:20, -30) = 2021-03-15T18:22:50

NA

dateTime: DateTime

numSeconds: number

DateTime

beginningOfHour

Returns a new DateTime value that changes the Time value in the input to the beginning of the specified hour. The minutes and seconds in the input change to 00:00.

beginningOfHour(2021-03-15T18:23:20) = 2021-03-15T18:00:00

NA

dateTime: DateTime

DateTime

beginningOfDay

Returns a new DateTime value that changes the Time value in the input to the beginning of the specified day. The hours, minutes, and seconds in the input change to 00:00:00.

beginningOfDay(2021-03-15T18:23:20) = 2021-03-15T00:00:00

NA

dateTime: DateTime

DateTime

beginningOfWeek

Returns a new Date value that changes the Day value from the input to the beginning of the first day of the specified week. The function treats Sunday as the first day of the week.

beginningOfWeek(2021-03-15) = 2021-03-14

beginningOfWeek(today()) = 2021-03-14

NA

date: Date

Date

beginningOfWeek

Returns a new DateTime value that changes the Day and Time values from the input to the beginning of the first day of the specified week. The function treats Sunday as the first day of the week.

beginningOfWeek(2021-03-15T18:23:20) = 2021-03-14T00:00:00

beginningOfWeek(now()) = 2021-03-14T00:00:00

NA

dateTime: DateTime

DateTime

beginningOfMonth

Returns a new Date value that changes the Day value from the input to the first day of the specified month.

beginningOfMonth(2021-11-15) = 2021-11-01

beginningOfMonth(today()) = 2021-03-01

NA

date: Date

Date

beginningOfMonth

Returns a new DateTime value that changes the Day value from the input to the first day of the specified month. The day and time in the input changes to 01T00:00:00.

beginningOfMonth(2021-03-15T18:23:20) = 2021-03-01T00:00:00

beginningOfMonth(now()) = 2021-03-01T00:00:00

NA

dateTime: DateTime

DateTime

beginningOfYear

Returns a new Date value that changes the Month and Day values from the input to the first day of the specified year.

beginningOfYear(2021-11-15) = 2021-01-01

beginningOfYear(today()) = 2021-01-01

NA

date: Date

Date

beginningOfYear

Returns a new DateTime value that changes the Month and Day values from the input to the first day of the specified year. It also sets the Time value to 00:00:00. The month, day, and time in the input changes to 01-01T00:00:00.

beginningOfYear(2021-03-15T18:23:20) = 2021-01-01T00:00:00

beginningOfYear(now()) = 2021-01-01T00:00:00

NA

dateTime: DateTime

DateTime

daysBetween

Returns the number of days between two dates. If the to Date value is earlier than the from Date value, the function returns a negative number equal to the number of days between the two dates.

daysBetween(2020-03-15, 2021-03-15) = 365

NA

from: Date

to: Date

Number

daysBetween

Returns the number of days between two DateTime values. If the to DateTime value is earlier than the from DateTime value, the function returns a negative number equal to the number of days between the two DateTime values.

daysBetween(2020-03-15T18:23:20, 2021-03-15T02:23:20) = 365

NA

from: DateTime

to: DateTime

Number

month

Returns the numerical value of the month in the Date input.

month(2021-03-15) = 3

NA

date: Date

Number

month

Returns the numerical value of the month in the DateTime input.

month(2021-03-15T18:23:20) = 3

NA

dateTime: DateTime

Number

year

Returns the numerical value of the year in the Date input.

year(2021-03-15) = 2021

NA

date: Date

Number

year

Returns the numerical value of the year in the DateTime input.

year(2021-03-15T18:23:20) = 2021

NA

dateTime: DateTime

Number

fromDateToString

Transforms a date input value into a string value. Accepts a format and locale. The format parameter represents the required format of the output string. The default format is uuuu-MM-dd and the default locale is en-US; however, these defaults can be modified.

fromDateToString(2021-03-15, uuuu-dd-MM, en-US) = 2021-15-03

fromDateToString(2021-03-15, uuuu/MM/dd, en-US) = 2021/03/15

fromDateToString(2021-03-15, eeee, dd MMMM, ES) = lunes, 15 marzo

Format: The ISO-8601 formatting to use on the Date. It represents the desired format of the output string. For example, this parameter accepts character patterns based on the Java 8 java.time.format. The default format is uuuu-MM-dd.

Locale: Optional ISO 3166 country code to use, such as en-US, AR, or ES. When you pass a translatable format, such as eeee and MMMM, a locale (such as ES) transforms the corresponding numeric values to a localized string.

date: Date

format: String

locale: String

String

fromDateTimeToString

Transforms a dateTime input value into a string value. Accepts a format and locale. The format parameter represents the desired format of the output string. The default format is uuuu-MM-dd’T’HH:mm:ssz and the default locale is en-US; however, these defaults can be modified.

fromDateTimeToString(2021-03-15T23:57:59Z, uuuu-MM-dd’T’HH:mm:ssz, en-US) = 2021-03-15T23:57:59Z

fromDateTimeToString(2021-03-15T23:57:59Z, MMMM dd, ES) = marzo 15

Format: The ISO-8601 formatting to use on the DateTime. It represents the desired format of the output string. For example, this parameter accepts character patterns based on the Java 8 java.time.format. The default format is uuuu-MM-dd’T’HH:mm:ssz.

Locale: Optional ISO 3166 country code to use, such as en-US, AR, or ES. When you pass a translatable format, such as eeee and MMMM, a locale (such as ES) transforms the corresponding numeric values to a localized string.

dateTime: DateTime

format: String

locale: String

String

fromDateTimeToNumber

Transforms a dateTime input value into a number value. The number is in milliseconds or seconds, depending on the selected unit. The default unit is seconds.

fromDateTimeToNumber(2015-10-01T23:57:59Z, seconds) = 1443743879

fromDateTimeToNumber(2015-10-01T23:57:59Z, milliseconds) = 1443743879000

Unit: The unit of time to use for the conversion: "milliseconds" or "seconds". The default unit is "seconds."

dateTime: DateTime

unit: String

Number

fromDateToDateTime

Transforms a date input value into a dateTime. It does so by adding a time. The default time is T00:00:00Z. All manual entries will be interpreted in UTC.

fromDateToDateTime(2021-03-15, T00:00:00Z) = 2021-03-15T00:00:00Z

fromDateToDateTime(2021-03-15, T23:57:59Z) = 2021-03-15T23:57:59Z

NA

date: Date

time: String

DateTime

List Functions

The Custom Expression Editor supports the following List formulas and operators:

Function Name Description Example Parameter Definition Input Data Type Parameters Output Data Type

joinBy

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

joinBy([a, b, c], ,] = a, b, c

joinBy([Hello, Composer] , - ) = Hello-Composer

joinBy([Mr, Max, Mule], emptyString()) = MrMaxMule

list separator

Note that you can use a List data pill, a function that returns a list (such as splitBy), or a list that you build manually using [ ] as a parameter to the function.

list: List<String>

separator: String

String

splitBy

Splits a string into a list of strings based on a separating string that matches part of the input string.

This filters out the matching string from the returned list. The separator can match any character in the input.

splitBy(Hello-Composer, -) = [Hello, Composer]

splitBy(192.88.99.0, .) = [192, 88, 99, 0]

text separator

text: String

separator: String

List<String>