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 |
Date |
Stores a year, month, and day as |
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 |
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: |
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 ( |
String |
Stores text, numbers that are not |
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. |
|
NA |
text: String |
String |
upper |
Returns the provided string in uppercase characters. |
|
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. |
|
NA |
text: String |
String |
trim |
Removes any blank spaces from the beginning and end of a string. |
|
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. |
|
NA |
text: String numCharacters: Number |
String |
last |
Returns the specified number of characters from the end of a string. |
|
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 |
|
NA |
text: String target: String replacement: String |
String |
fromStringToBoolean |
Transforms a string input value into a boolean value. |
|
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 |
|
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 Locale: Optional ISO 3166 country code to use, such as |
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 |
|
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 Locale: Optional ISO 3166 country code to use, such as |
text: String format: String |
DateTime |
fromStringToNumber |
Transforms a string input value into a number value. |
|
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 |
|
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. |
|
NA |
number: Number |
Number |
ceil |
Rounds a number up to the nearest whole number. |
|
NA |
number: Number |
Number |
floor |
Rounds a number down to the nearest whole number. |
|
NA |
number: Number |
Number |
abs |
Returns the absolute value of a number. |
|
NA |
number: Number |
Number |
fromNumberToString |
Transforms a number value (whole or decimal) into a string value. |
|
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. |
|
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. |
|
NA |
NA |
Date |
now |
Returns a DateTime value for the current date and time. |
|
NA |
NA |
DateTime |
addDays |
Creates and returns a Date value incremented or decremented by the specified number of days. |
|
NA |
date: Date numDays: number |
Date |
addDays |
Creates and returns a DateTime value incremented or decremented by the specified number of days. |
|
NA |
dateTime: DateTime numDays: number |
DateTime |
addMonths |
Creates and returns a Date value incremented or decremented by the specified number of months. |
|
NA |
date: Date numMonths: number |
Date |
addMonths |
Creates and returns a DateTime value incremented or decremented by the specified number of months. |
|
NA |
dateTime: DateTime numMonths: number |
DateTime |
addYears |
Creates and returns a Date value incremented or decremented by the specified number of years. |
|
NA |
date: Date numYears: number |
Date |
addYears |
Creates and returns a DateTime value incremented or decremented by the specified number of years. |
|
NA |
dateTime: DateTime numYears: number |
DateTime |
addHours |
Creates and returns a DateTime value incremented or decremented by the specified number of hours. |
|
NA |
dateTime: DateTime numHours: number |
DateTime |
addMinutes |
Creates and returns a DateTime value incremented or decremented by the specified number of minutes. |
|
NA |
dateTime: DateTime numMinutes: number |
DateTime |
addSeconds |
Creates and returns a DateTime value incremented or decremented by the specified number of seconds. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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 |
|
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. |
|
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 |
|
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. |
|
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. |
|
NA |
from: DateTime to: DateTime |
Number |
month |
Returns the numerical value of the month in the Date input. |
|
NA |
date: Date |
Number |
month |
Returns the numerical value of the month in the DateTime input. |
|
NA |
dateTime: DateTime |
Number |
year |
Returns the numerical value of the year in the Date input. |
|
NA |
date: Date |
Number |
year |
Returns the numerical value of the year in the DateTime input. |
|
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 |
|
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 Locale: Optional ISO 3166 country code to use, such as |
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 |
|
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 Locale: Optional ISO 3166 country code to use, such as |
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. |
|
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. |
|
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. |
|
list separator Note that you can use a |
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. |
|
text separator |
text: String separator: String |
List<String> |