Transforming text & dates
Transformation helpers change the structure or content of a value — not just how it looks.
Concat
Combines any number of values into a single string.
concat value1 value2 ...
Example
Coalesce
Returns the first non-null, non-empty value from its arguments. The strings null and undefined are also treated as empty.
coalesce value1 value2 ...
| Argument | Type | Description |
|---|---|---|
| value1, ... | any | Values evaluated in order; the first non-empty one is returned. |
Example
Brackets
Wraps a value in parentheses, with optional prefix and suffix text placed inside the brackets.
brackets value prefix suffix
| Argument | Type | Description |
|---|---|---|
| value | string | The value to wrap. |
| prefix | string | Optional: text before the value, inside the brackets. |
| suffix | string | Optional: text after the value, inside the brackets. |
Example
Replace
Replaces every occurrence of a substring with a replacement string.
replace originalText replaceMatch replaceWith
| Argument | Type | Description |
|---|---|---|
| originalText | string | The string to search inside. |
| replaceMatch | string | The substring to find. |
| replaceWith | string | The replacement string. |
Example
Input: 'ETA TBC, berth TBC' → Output: 'ETA Confirmed, berth Confirmed'
Replace (regular expression)
Like replace, but the search pattern is a regular expression.
regexReplace originalText replaceMatch replaceWith
| Argument | Type | Description |
|---|---|---|
| originalText | string | The string to search inside. |
| replaceMatch | string | Regular expression pattern to find. |
| replaceWith | string | The replacement string. |
Example
Input: 'Berth 12' → Output: 'Berth TBA'
Substring
Extracts a portion of a string by start index and optional length.
substring startIndex length
| Argument | Type | Description |
|---|---|---|
| startIndex | number | Zero-based starting position. |
| length | number | Optional: number of characters to extract. Omit to go to end of string. |
Example
Trim
Removes whitespace (or a specified character) from both ends of a string.
trim
Example
Truncate
Shortens a string to a maximum length. When an ellipsis is provided, the total output length (including the ellipsis) stays within maxLength.
truncate value maxLength ellipsis
| Argument | Type | Description |
|---|---|---|
| value | string | The string to truncate. |
| maxLength | number | Maximum output length (including ellipsis if provided). |
| ellipsis | string | Optional: suffix appended when truncated, e.g. .... Defaults to no suffix. |
Example
Newline
Replaces a specified string with line breaks.
newline stringToReplace
Example
Input: 'Amsterdam, Rotterdam, Antwerp'
Output:
Amsterdam
Rotterdam
Antwerp
Text to HTML
HTML-encodes a string and converts \r\n line breaks into <br/> tags. Useful when displaying user-entered plain text inside HTML templates.
textToHtml text
| Argument | Type | Description |
|---|---|---|
| text | string | The plain-text string to transform. |
Example
Input: 'Berth <7>\r\nConfirmed' → Output: Berth <7><br/>Confirmed
Zero if null
Replaces a null number value with 0 instead of an empty string (which is the default engine behaviour).
zeroIfNull
Example
Encrypt
Generates an encrypted, reversible string — used primarily for passing unreadable tokens to the SHIPM8 backend, not for storing sensitive data.
encrypt seed validityInHours
| Argument | Type | Description |
|---|---|---|
| seed | string | Optional: seed that directs the encryption mechanism. |
| validityInHours | number | Optional: hours before the encrypted token expires. |
Example
Date — add
Adds or subtracts a time amount from a date. Output format is always dd-MM-yyyy HH:mm.
dateAdd date amount type
| Argument | Type | Description |
|---|---|---|
| date | string | The date to adjust. |
| amount | number | Amount to add; use a negative value to subtract. |
| type | string | Unit of time: d / day / days, H / hour / hours, m / minute / minutes. |
Example
Date — from UTC
Converts a UTC datetime to a local datetime in the specified timezone (or the server's local timezone if omitted). The input is always treated as UTC.
dateFromUtc date timezoneId format
| Argument | Type | Description |
|---|---|---|
| date | string | The UTC datetime to convert. |
| timezoneId | string | Optional: Windows timezone ID, e.g. W. Europe Standard Time. Defaults to server local. |
| format | string | Optional: output format. Defaults to dd-MM-yyyy HH:mm. |
Example
Date — to UTC
Converts a local datetime in the specified timezone to UTC.
dateToUtc date timezoneId format
| Argument | Type | Description |
|---|---|---|
| date | string | The local datetime to convert. |
| timezoneId | string | Optional: Windows timezone ID of the input date. Defaults to server local. |
| format | string | Optional: output format. Defaults to dd-MM-yyyy HH:mm. |
Example
Time — add
Adds or subtracts a time amount from a timespan value (e.g. 14:00:00).
timeAdd time amount type
| Argument | Type | Description |
|---|---|---|
| time | string | Timespan string, e.g. 14:00:00. |
| amount | number | Amount to add; use a negative value to subtract. |
| type | string | Unit of time: H / hour / hours, m / minute / minutes. |
Example
Timeline
Expands an array of date-ranged items into a timeline — one row per interval period covered. This is a block helper.
timeline inputArray dateFrom dateTo interval outputFieldKey outputFormat appendData
| Argument | Type | Description |
|---|---|---|
| inputArray | array | The array to expand. |
| dateFrom | string | Field name for the start date. |
| dateTo | string | Field name for the end date. |
| interval | string | hourly, daily, monthly, quarterly, or yearly. |
| outputFieldKey | string | Name of the field added to each output item containing the timeline key. |
| outputFormat | string | Date format for the timeline key. |
| appendData | string | Optional: fillgap creates empty records for intervals with no matching item. |
Example
Data:
{
"portCalls": [
{ "eta": "2024-03-10T08:00", "etd": "2024-03-11T18:00", "port": "Rotterdam" },
{ "eta": "2024-03-12T08:00", "etd": "2024-03-13T12:00", "port": "Antwerp" }
]
}
Result:
10-03-2024 -> Rotterdam
11-03-2024 -> Rotterdam
12-03-2024 -> Antwerp
13-03-2024 -> Antwerp