- 1 Minute to read
- Print
- DarkLight
Function Syntax and Formatting
- 1 Minute to read
- Print
- DarkLight
Introduction
Functions follow a specific syntax that allows data to be interpreted and executed as commands or code. This guide explains function structure, parameters, and data formatting.
Function Structure
Functions use the following format:
<%${library:function_name(argument1, argument2, ...)}%>
Key Syntax Elements
Element | Description |
---|---|
Placeholder |
|
Code Block |
|
Function | Written in the format |
Parameters | Enclosed in parentheses |
Formatting Parameters
Parameter values vary depending on their source and type.
Static Values
String Values: Enclosed in single quotes (
'example'
).Operators & Comparisons: (
'<=', 'empty', 'null'
) enclosed in single quotes.Boolean Values:
'true'
,'false'
(in single quotes).Numeric Values: Entered without quotes (
1234
).
Referencing Data
Functions can retrieve values from different data sources, including attributes and related data sets.
Attributes
Referenced using the format:
user.customAttribute['AttributeName']
Example:
user.customAttribute['Destination']
Linked Related Data Sets
Referenced similarly to attributes, using:
user.relatedAttribute['DataSetName']['ColumnName']
Example:
user.relatedAttribute['Orders']['TotalPrice']
Retrieves the
TotalPrice
from theOrders
dataset linked touser.Email
.
Unlinked Related Data Sets
Requires the
ecx:related
function to identify values using a key.ecx:related('DataSetName', user['KeyAttribute'])['ColumnName']
Example:
ecx:related('OrderTotalsPerCustomer', user['Email'])['TotalOrderValue']
Retrieves
TotalOrderValue
fromOrderTotalsPerCustomer
usinguser.Email
as the key.