G Suite Business customers can preview App Maker. Ask your domain admin to apply for early access.

Binding Transformers Reference

arrayToStr

Converts an array of strings to a string by concatenating them using a comma and escaping any commas in the elements of the array using a backslash. Null or empty strings in the array are ignored. For example, the array ["abc", ",def"] is transformed to the string "abc,\,def". This transformer mimics the behavior of the default array of strings to string conversion in bindings.

Input TypeArray[string]
Output Typestring
Reverse TransformerstrToArray

Back to Top

boolToNum

Converts a boolean to a number. The boolean true value is converted to 1.0 and false is converted to 0.0 . A null value is converted to null. This transformer mimics the behavior of the default boolean to number conversion in bindings.

Input Typeboolean
Output Typedouble
Reverse TransformernumToBool

Back to Top

boolToStr

Converts the boolean true value to the string "true", the boolean false value to the string "false", and a null value to a null string. This transformer mimics the behavior of the default boolean to string conversion in bindings.

Input Typeboolean
Output Typestring
Reverse TransformerstrToBool

Back to Top

distinct

Removes duplicates in an array. For example, applying the distinct transformer to an array [1, 2, 1, 3, null, null] produces [1, 2, 3, null].

Input TypeArray[Object]
Output TypeArray[Object]
Reverse TransformerNo inverse.

Back to Top

emptyToNull

Converts an empty string to a null string. All other strings are not changed. This transformer behaves the same in both input and output directions.

Input Typestring
Output Typestring
Reverse TransformernullToEmpty

Back to Top

flatten

Flattens an array of arrays to an array by concatenating all the sub-arrays. For example, the array [[1, 2], [3, 4]] would be transformed to [1, 2, 3, 4]. There is no inverse for this transformer, so a path that uses this transformer will be read only.

Input TypeArray[Array[Object]]
Output TypeArray[Object]
Reverse TransformerNo inverse.

Back to Top

formatDate

Formats a date as a string according to a date pattern. App Maker automatically converts between dates and strings using the yyyy-MM-dd pattern for bindings, but you can use this transformer to specify your own custom date pattern.

Input Typedate
Output Typestring
Reverse TransformerparseDate

Parameters

Name Type Description
pattern string A date format pattern according to the GWT date format specification. For example, to format a date as year with four digits, two digit month, two digit day, and a backslash as the separator, you can use the pattern yyyy/MM/dd.

Back to Top

formatNumber

Formats a number as a string according to a number pattern. App Maker automatically converts between numbers and strings in bindings using no group separators and the most precise string representation, but you can use this transformer to specify your own number pattern. You can control group separators, rounding, scientific notation, negative number formatting, etc.

Input Typedouble
Output Typestring
Reverse TransformerparseNumber

Parameters

Name Type Description
pattern string A number format pattern according to the GWT number format specification. For example, to format numbers with group separators and exactly two decimal places, you can use the pattern #,###.00.

Back to Top

fromBoolean

Maps boolean true and false values to the two transformer parameters. For example, if the two parameter values for this transformer are "yes" and "no", then true will be mapped to the string "yes" and false will be mapped to the string "no". null will always be mapped to null

Input Typeboolean
Output Typeobject
Reverse TransformertoBoolean

Parameters

Name Type Description
trueValue object The value that should be mapped to the boolean true value. It must be the same type as the falseValue; both values should be strings, numbers, or booleans.
falseValue object The value that should be mapped to the boolean false value. It must be the same type as the trueValue; both values should be strings, numbers, or booleans.

Back to Top

join

Converts an array of strings to a string by concatenating them using a delimiter and an escape character. Null strings in the array are treated as if they were empty strings when joining strings. For example, the array ["abc", ",def"] is transformed to the string "abc,\,def" if the delimiter is the comma character and the escape character is a backslash.

Input TypeArray[string]
Output Typestring
Reverse Transformersplit

Parameters

Name Type Description
delimiter char A single character delimiter that separates different strings. For example, A CSV file uses a comma to separate fields in a single row. Optional, defaults to ","
escape char A single character that is used to escape the delimiter so that it can be used in a string and also escapes itself. For example, if comma is the delimiter and back-slash is the escape character, then join the strings "abc" and "d,e\f" produces "abc,d\,e\\f". Optional, defaults to "\"

Back to Top

nullToEmpty

Converts an empty string to a null string. All other strings are not changed. This transformer behaves the same in both input and output directions.

Input Typestring
Output Typestring
Reverse TransformeremptyToNull

Back to Top

numToBool

Converts a number to a boolean. 0.0 is converted to false, any other number is converted to true. A null value is converted to null. This transformer mimics the behavior of the default number to boolean conversion in bindings.

Input Typedouble
Output Typeboolean
Reverse TransformerboolToNum

Back to Top

numToStr

Formats a number as a string without any group separators and with as many decimal places as necessary. This transformer mimics the behavior of the default number to string conversion in bindings.

Input Typedouble
Output Typestring
Reverse TransformerstrToNum

Back to Top

parseDate

Parses a string as a date according to a date pattern. App Maker automatically converts between dates and strings using the yyyy-MM-dd pattern for bindings, but you can use this transformer to specify your own custom date pattern.

Input Typestring
Output Typedate
Reverse TransformerformatDate

Parameters

Name Type Description
pattern string A date format pattern according to the GWT date format specification. For example, to format a date as year with four digits, two digit month, two digit day, and a backslash as the separator, you can use the pattern yyyy/MM/dd.

Back to Top

parseNumber

Parses a number to a string according to a number pattern. App Maker automatically converts between numbers and strings in bindings using no group separators and the most precise string representation, but you can use this transformer to specify your own number pattern.

Input Typestring
Output Typedouble
Reverse TransformerformatNumber

Parameters

Name Type Description
pattern string A number format pattern according to the GWT number format specification. For example, to format numbers with group separators and exactly two decimal places, you can use the pattern #,###.00.

Back to Top

readonly

Does not transform input, but is not reversible. This makes a property path which is not read-only behave as if it is read-only.

Input Typeobject
Output Typeobject
Reverse TransformerNo inverse.

Back to Top

sort

Sorts an array of items by their natural order (for strings, numbers, booleans, and dates) or by the natural order of a property that you specify. You can also specify whether the sorting is in ascending or descending order. For example, you can sort an array of numbers in ascending order using #sort() or in descending order using #sort('desc'). You can also sort an array of records by a field called 'myField' using #sort('asc', 'myField').

Input TypeArray[Object]
Output TypeArray[Object]
Reverse TransformerNo inverse.

Parameters

Name Type Description
direction string Whether the sorting should be in descending or ascending order. "asc" means the sorting will be in ascending order, "desc" means the sorting will be in descending order. Optional, defaults to "asc"
projectionPathStr string A string representing a property path. When objects are sorted, the property path is used to obtain the "value" of the object and the ordering is based on that value. For example, if you want to sort an array of records by a field named "id", you would specify a projection path of "id". Note that the type of "id" field must be an App Maker primitive type: string, number, boolean, or date. If null is used, then object itself is used for sorting and must be an App Maker primitive type. Optional, defaults to null

Back to Top

split

Splits a string into an array of strings using a delimiter and an escape character. For example, the string "abc,,\,def" is transformed to the strings "abc", "", ",def" , if the delimiter is the comma character and the escape character is a backslash. Whitespace at the beginning or end of each string is removed.

Input Typestring
Output TypeArray[string]
Reverse Transformerjoin

Parameters

Name Type Description
delimiter char A single character delimiter that separates different strings. For example, A CSV file uses a comma to separate fields in a single row. Optional, defaults to ","
escape char A single character that is used to escape the delimiter so that it can be used in a string and also escapes itself. For example, if comma is the delimiter and back-slash is the escape character, then join the strings "abc" and "d,e\f" produces "abc,d\,e\\f". Optional, defaults to "\"

Back to Top

strToArray

Converts an array of strings to a string by concatenating them using a comma and escaping any commas in the elements of the array using a backslash. Null or empty strings in the array are ignored. For example, the array ["abc", ",def"] is transformed to the string "abc,\,def". This transformer mimics the behavior of the default string to array of strings conversion in bindings.

Input Typestring
Output TypeArray[string]
Reverse TransformerarrayToStr

Back to Top

strToBool

Converts a string to a boolean. The string is transformed to true if it is equal to the string "true" ignoring case, otherwise the string is transformed to false. This transformer mimics the behavior of the default string to boolean conversion in bindings.

Input Typestring
Output Typeboolean
Reverse TransformerstrToBool

Back to Top

strToNum

Parses a string as a number according to the java.lang.Double#valueOf(String) method. This transformer mimics the behavior of the default string to number conversion in bindings. Note that {@code NaN} and {@code Infinite} values are prohibited.

Input Typestring
Output Typedouble
Reverse TransformernumToStr

Back to Top

toBoolean

Transforms an object to a boolean value by comparing it to the "true" value parameter. If the object is equal to the "true" value parameter, then the boolean true value is returned, otherwise the boolean false value is returned. For example, if the two parameter values for this transformer are "yes" and "no", then the value "yes" would be mapped to true and any other value would be mapped to false.

Input Typeobject
Output Typeboolean
Reverse TransformerfromBoolean

Parameters

Name Type Description
trueValue object The value that should be mapped to the boolean true value. It must be the same type as the falseValue; both values should be strings, numbers, or booleans.
falseValue object The value that should be mapped to the boolean false value. It must be the same type as the trueValue; both values should be strings, numbers, or booleans.

Back to Top

trim

Trims whitespace from the beginning and end of a string. For example, the string " abc def " will be trimmed to "abc def". Whitespace characters are any unicode characters from 0000 - 0020 which includes the standard ASCII space, next line, carriage feed, and line feed characters. This transformer behaves the same in both input and output directions.

Input Typestring
Output Typestring
Reverse Transformertrim

Back to Top