Logic & Dynamic Binding
Master reference for dynamic variables, formatting, aggregations, dynamic component attributes, conditional rendering, and dynamic collections.
The editor provides a powerful expression and binding engine that lets you connect canvas elements directly to dynamic dataset fields, apply conditional display rules, transform text and numbers, and loop over collections.
1. Working with Variables
Variables insert dynamic text or numerical values into your document output at render time.
Inserting Variables
You can insert variables into your canvas through two methods:
- Drag-and-Drop: Drag a Variable (
{}) block directly from the Block Manager onto the canvas. - Slash Command (
/): Type/inside any active text block to open the cascading path selector dropdown and choose a payload field.
Editing Variables
To configure an existing variable, click the Edit Logic button in the Style Manager or click the Data icon (🗄️) on the floating component toolbar. This opens the Edit Variable modal where you can configure:
- Variable Path: Select or edit the JSON key path mapping to your payload data.
- Default Value: Define fallback text to display if the resolved variable path is
null,undefined, or empty (e.g.,Guest). - Segment Selection Index (
atIndex): Specify an index number to extract a single item from an array path.
2. Formatting & Aggregation Reference
Depending on the variable type and path, you can apply custom data formatting options and mathematical aggregations directly inside the variable settings modal.
Aggregation Configuration (AggregationConfig)
When binding a variable to an array or list of values, you can aggregate the data using the following calculation methods:
| Aggregation Method | Description | Configuration Parameters |
|---|---|---|
join | Combines array elements into a single string. | joinSeparator, joinFinalSeparator |
sum | Computes the numerical sum of the array. | field |
mean | Calculates the average value of the array. | field |
min | Extracts the lowest numerical value. | field |
max | Extracts the highest numerical value. | field |
count | Returns the total item count of the array. | N/A |
first | Returns the first item in the array. | field |
last | Returns the last item in the array. | field |
at | Returns the item at a specific array index. | atIndex |
Formatting Options (FormatOptions)
Apply display transformations for numbers, currency, dates, strings, and charts:
Number & Currency Formatting
- Decimals (
decimals): Controls the number of decimal places to display. - Separators: Customize
thousandsSeparator(e.g.,,) anddecimalSeparator(e.g.,.). - Number Abbreviation (
abbreviate): Compacts large numbers using custom suffix labels (abbreviationThousands,abbreviationMillions,abbreviationBillions,abbreviationTrillions). - Currency Symbol: Define
currencySymbol(e.g.,$,€) and setcurrencyPositionto"before"or"after". - Percentage (
percentage): Formats numbers as percentages (e.g.,0.15renders as15%).
Date & Duration Formatting
- Date Formats: Select standard presets via
dateFormator specify custom syntax usingcustomDateFormat(e.g.,YYYY-MM-DD). - Durations: Convert numerical values into time durations using
durationUnit(seconds,minutes,hours,days) anddurationFormat(shortvs.long).
Text Transformations
- Transform: Modify text case using
uppercase,lowercase,capitalize,truncate, or render inlinemarkdown. - Truncate Length (
truncateLength): Specifies character limits whentransformis set totruncate. - Encoding (
encode): Enables URL or string encoding.
3. Dynamic Component Attributes & Images
Component settings inside the Right Inspector Panel featuring a Data icon (🗄️) can be bound dynamically to payload data paths instead of static values.
Setting Up Dynamic Images
To render dynamic images (such as user avatars, generated charts, or dynamic product photos):
- Select an Image component on the canvas.
- Locate the src field in the Right Inspector Panel.
- Click the Data icon (
🗄️) next to thesrcinput field. - Select the variable path containing your hosted image URL string (e.g.,
{{user.avatar_url}}ordata:image/svg+xml;...).
4. Conditional Logic
Conditional components allow you to show or hide document sections dynamically based on logical rules.
Adding Conditions
- Context Menu Wrapping: Click the More Options (
...) menu on any supported canvas element and choose Wrap in Condition. This wraps the selected block in a conditional statement and keeps theFalse / Elsebranch hidden by default. - Direct Block Insertion: Drag a Condition block directly from the Block Manager. Direct insertion keeps both the
TrueandFalse / Elsecontent blocks visible on the canvas by default.
Editing Conditions
Click the Edit Logic button or Data icon (🗄️) on a condition block to open the Edit Condition modal:
- Logical Operators: Toggle between
AND,OR, andXORlogic for combining multiple rules. - Adding Rules (
+ Rule): Define single comparisons (e.g.,name->startsWith->B). - Adding Groups (
+ Group): Create nested sub-conditions for complex multi-level logic operations.
5. Dynamic Collections & Tables
Collection blocks allow you to repeat visual layouts, list items, or table rows across dynamic data arrays.
Configuring Collections
Click the Edit Logic button or Data icon (🗄️) on a collection container or table block to configure iteration parameters:
- Variable Path: Select the array payload path to iterate over (e.g.,
itemsorinvoice.line_items). - Sorting (
+ Sorting): Add sort criteria to arrange items by specific fields in ascending or descending order. - Filters (
Filter): Build item filter rules using the integrated condition builder (AND/OR/XORrules and groups) to suppress specific array items from rendering.
Dynamic Tables
Applying a collection to a Table component automatically creates dynamic repeating rows that expand based on the length of the bound dataset.