Referencing Functions
You can reference functions to quickly configure connectors when editing and designing a composite application.
Figure 1 describes how to use functions in composite applications.
Category
Math, string, encryption and decryption, date and time, encoding and decoding, and number system conversion.
| Category | Function | Description |
|---|---|---|
| Math (2) | sum(array arr) | Returns the sum of all numbers in an array. For example, ${sum(3,5,6)} returns 14. |
| avg(array arr) | Returns the average of all numbers in an array. For example, ${avg (2,4)} returns 3. | |
| String (29) | uuid() | Generates a random UUID consisting of letters and digits. |
| upper(string str) | Converts a string into uppercase letters. For example, ${upper('abc')} returns ABC. | |
| lower(string str) | Converts a string into lowercase letters. For example, ${lower('ABC')} returns abc. | |
| camelize(string str) | Converts words in a string into the camel case format, deletes all spaces, and converts the first letter of each word except the first word into the uppercase format. For example, ${camelize('aaa_bbb_ccc')} returns aaaBbbCcc. | |
| dasherize(string str) | Converts words in a string into the kebab case format, letters into lowercase letters, and all spaces into hyphens (-). For example, ${dasherize('Aaa Bbb Ccc')} returns aaa-bbb-ccc. | |
| capitalize(string str) | Converts the first letter of each word into the uppercase format and the other letters into the lowercase format. For example, ${capitalize('aaaBbbCcc')} returns Aaa Bbb Ccc. | |
| charCode(string char) | Converts characters to character encoding. For example, ${charCode('hello')} returns 104. | |
| fromCharCode(number charCode) | Converts a character encoding into a string. For example, ${fromCharCode(104)} returns h. | |
| charCodeAt(string str, number index) | Returns the character encoding at the index in a string. For example, ${charCodeAt('hello', 2)} returns 108. | |
| isAlpha(string str) | Returns a Boolean value that indicates whether a string contains only English letters. For example, ${isAlpha ('abc') returns true, and ${isAlpha ('a-b-c')} returns false. | |
| isAlphanumeric(string str) | Returns a Boolean value that indicates whether a string contains only English letters or digits. For example, ${isAlphanumeric ('aBc123')} returns true, and ${isAlphanumeric ('aBc-123')} returns false. | |
| isNumeric(string str) | Returns a Boolean value that indicates whether a string contains only digits. For example, ${isNumeric ('123')} returns true, and ${isNumeric ('1-2-3')} returns false. | |
| isLowerCase(string str) | Returns a Boolean value that indicates whether a string contains only lowercase letters. For example, ${isLowerCase('abc')} returns true, and ${isLowerCase('aBc')} returns false. | |
| isUpperCase(string str) | Returns a Boolean value that indicates whether a string contains only uppercase letters. For example, ${isUpperCase('ABC')} returns true, and ${isUpperCase('AbC')} returns false. | |
| isWhitespace(string str) | Returns a Boolean value that indicates whether a string contains only spaces. For example, ${isWhitespace(' ')} returns true, and ${isWhitespace('a b c')} returns false. | |
| leftPad(string str, number offset) | If the string is shorter than the offset, pads the left side of the string with spaces. For example, ${leftPad('abc', 4)} returns " abc". | |
| rightPad(string str, number offset) | If the string is shorter than the offset, pads the right side of the string with spaces. For example, ${rightPad('abc', 4)} returns "abc ". | |
| substringAfter(string str, string separator) | Gets the substring after the first separator. For example, ${substringAfter('a,b,c,d', ',')} returns b,c,d. | |
| substringAfterLast(string str, string separator) | Gets the substring after the last separator. For example, ${substringAfterLast('a,b,c,d', ',')} returns d. | |
| substringBefore(string str, string separator) | Gets the substring before the first separator. For example, ${substringBefore('a,b,c,d', ',')} returns a. | |
| substringBeforeLast(string str, string separator) | Gets the substring before the last separator. For example, ${substringBeforeLast('a,b,c,d', ',')} returns a,b,c. | |
| unwrap(string str, string wrapper) | Returns a string without the wrapper text. The wrapper text is the value before and/or after a string. For example, ${unwrap("/test/", "/")} returns test. | |
| withMaxSize(string str, number size) | Limits the size of a string. For example, ${withMaxSize('abcd', 3)} returns abc. | |
| wrapIfMissing(string str, string wrapper) | If a string is not wrapped, adds the wrapper at the beginning or end. If the wrapper already exists at the beginning or end, updates only the missing end. For example, ${wrapIfMissing("/test", "/")} returns /test/. | |
| wrapWith(string str, string wrapper) | Adds the wrapper at the beginning or end of a string. For example, ${wrapWith("test", "/")} returns /test/. | |
| ordinalize(number num) | Converts num to an ordered character string, for example, 1st, 2nd, or 3rd. For example, ${ordinalize(3)} returns 3rd. | |
| appendIfMissing(string str, string value) | If a string does not end with the value, adds it there. For example, ${appendIfMissing('ab', 'cd')} returns abcd. | |
| prependIfMissing(string str, string value) | If a string does not start with the value, adds it there. For example, ${prependIfMissing('cd', 'ab')} returns abcd. | |
| repeat(string str, number times) | Repeats the given number of times. For example, ${repeat('abc', 3)} returns abcabcabc. | |
| Encryption and decryption (4) | hash(string value, string algorithm) | Calculates the hash value using a supported algorithm. The algorithm must be MD2, MD5, SHA-1, SHA-256, SHA-384 or SHA-512. For example, ${hash('abcd', 'MD5')} returns e2fc714c4727ee9395f324cd2e7f331f. |
| hmac(string value, string secret, string algorithm) | Generates a hash-based authentication code using the provided value, key, and hash function algorithm. The algorithm must be HMACSHA1, HMACSHA256, or HMACSHA512. For example, ${hmac('abcd', 'test', 'HmacSHA1')} returns bcde772eafae465fe002b2bbb5c68d66da0d241a. | |
| encrypt(string value, string secret, string transformation) | Encrypts the value using the specified JDK and key, and converts the encryption into a readable format using Base64. For example, ${encrypt('Hello', '8byteKey', 'DES/CBC/PKCS5Padding')} returns Ic3THvsowTV3itOf40K56w==. | |
| decrypt(string value, string secret, string algorithm, string mode, string padding) | Decrypts the Base64 value using the specified JDK and key. For example, ${decrypt("Ic3THvsowTV3itOf40K56w==", "8byteKey", "DES/CBC/PKCS5Padding")} returns Hello. | |
| Date and time (20) | now() | Returns the current date and time. For example, ${now()} returns 2025-03-26T03:17:37. |
| compare(string datetime1, string datetime2) | If datetime1 > datetime2, returns 1; if datetime1 < datetime2, returns -1; if datetime1 == datetime2, returns 0. For example, ${compare('2025-03-26T05:20:30Z', '2025-03-27T05:20:30Z')} returns -1. | |
| atBeginningOfDay(string datetime) | Returns the midnight time value of a given time. For example, ${atBeginningOfDay('2025-03-26T05:20:30Z')} returns 2025-03-26T00:00:00Z. | |
| atBeginningOfHour(string datetime) | Returns the given date and time, with minute and second as 0. For example, ${atBeginningOfHour('2025-03-26T05:20:30Z')} returns 2025-03-26T05:00:00Z. | |
| atBeginningOfMonth(string datetime) | Returns the first day of the month, with time as midnight. For example, ${atBeginningOfMonth('2025-03-26T05:20:30Z')} returns 2025-03-01T00:00:00Z. | |
| atBeginningOfWeek(string datetime) | Returns the first day of the current week, with time as midnight. For example, ${atBeginningOfWeek('2025-03-26T05:20:30Z')} returns 2025-03-23T00:00:00Z. | |
| atBeginningOfYear(string datetime) | Returns the first day of the year, with time as midnight. For example, ${atBeginningOfYear('2025-03-26T05:20:30Z')} returns 2025-01-01T00:00:00Z. | |
| changeTimeZone(string datetime, string timezone) | Changes the time zone, which usually results in a change in the local date and time. For example, ${changeTimeZone('2024-05-22T08:25:16Z', 'UTC')} returns 2024-05-22T08:25:16Z. | |
| daysBetween(string datetime1, string datetime2) | Returns the number of days between datetime1 and datetime2. For example, ${daysBetween('2024-05-22T08:25:16Z', '2024-05-28T18:25:16Z')} returns 6. | |
| format(string datetime, string outputFormat) | Converts a given datetime into the specified format. For example, ${format('2024-05-22T08:25:16Z', 'yyyy/MM/dd HH:mm')} returns 2024/05/22 08:25. | |
| isLeapYear(string datetime) | Returns a Boolean value indicating whether datetime is a leap year. For example, ${isLeapYear('2024-05-22T08:25:16Z')} returns true. | |
| plus(string datetime, string period) | Adds a date to a datetime. For example, ${plus('2024-05-22T08:25:16Z', 'P1D')} returns 2024-05-23T08:25:16Z. | |
| minus(string datetime, string period) | Subtracts a date to a datetime. For example, ${minus('2024-05-22T08:25:16Z', 'P1D')} returns 2024-05-21T08:25:16Z. | |
| parse(string|number datetime, string inputFormat) | Parses the datetime using the input format and returns a value in the default format. If the epoch or timestamp value is used as the datetime, epoch or timestamp can be used as inputFormat. For example, ${parse('12/31/1990 10:10:10', 'MM/dd/yyyy HH:mm:ss')} returns 1990-12-31T10:10:10Z. | |
| toLocalDate(string datetime) | Localizes a date. For example, ${toLocalDate('2024-05-22T08:25:16Z')} returns 2024-05-22. | |
| toLocalDateTime(string datetime) | Localizes a date and time. For example, ${toLocalDateTime('2024-05-22T08:25:16Z')} returns 2024-05-22T08:25:16. | |
| toLocalTime(string datetime, string format) | Localizes a time. For example, ${toLocalTime('2024-05-22T08:25:16Z')} returns 08:25:16. | |
| today() | Returns the midnight time of the current day. | |
| tomorrow() | Returns the midnight time of the next day. | |
| yesterday() | Returns the midnight time of the previous day. | |
| Encoding and decoding (2) | encode(string data, string encoding="UTF-8") | Converts a string to the application/x-www-form-urlencoded format using the provided encoding scheme to obtain insecure bytes. The default encoding is UTF-8. For example, ${encode('Hello, world', encoding="UTF-8")} returns Hello%EF%BC%8C%E4%B8%96%E7%95%8C. |
| decode(string data, string encoding="UTF-8") | Decodes the application/x-www-form-urlencoded string using a specific encoding scheme to determine which characters are represented by a continuous sequence in the form of %xy. For example, ${decode('Hello%EF%BC%8C%E4%B8%96%E7%95%8C', encoding="UTF-8")} returns Hello, world. | |
| Number system conversion (9) | fromBase64(string value) | Converts a Base64 code to a value. For example, ${fromBase64('SGVsbG8=')} returns Hello. |
| toBase64(any value) | Base64-encodes a value. Currently, arrays and payload keywords in the ${083xxx|param} format are not supported. Arrays should be enclosed in single quotation marks ('), as shown in the following figure.
For example, ${toBase64('Hello')} returns SGVsbG8=. | |
| fromHex(string value) | Converts a hexadecimal number to a value. For example, ${fromHex(13)} returns 19. | |
| toHex(any value) | Converts a value to a hexadecimal number. For example, ${toHex(19)} returns 13. | |
| fromBinary(number value) | Converts a value from binary to decimal. For example, ${fromBinary(101)} returns 5. | |
| fromHex(number value) | Converts a value from hexadecimal to decimal. For example, ${fromHex(13)} returns 19. | |
| fromRadixNumber(number value, number baseAsBinary) | Converts a value to a decimal number. For example, ${fromRadixNumber(101, 2)} returns 5. | |
| toBinary(number value) | Converts a value from decimal to binary. For example, ${toBinary(8)} returns 1000. | |
| toRadixNumber(number value, number baseAsDecimal) | Converts a value to a specified number system. For example, ${toRadixNumber(5, 2)} returns 101. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

