Tables

This article describes the different table bindings and the required structure of the transformed data for the DynamicTable binding and CellRepeater binding.

Although the DynamicTable binding type has more configuration options and, thus, is more flexible, it is not recommended to use unless necessary, since complexity may rise drastically. The DynamicTable binding is only necessary if there is need for controlling column visibility or dynamic formatting of the table and/or column widths.

Table

Functions like a repeat binding around a table row, but can also be wrapped around an entire table. If the content control wraps around a whole table, then the first row with bindings until the last row with bindings will be duplicated. Like with repeat, the scope is changed for each duplicate.

Syntax

{ "BindingType": "Table", "BindingKey": "ArrayPath" }

Parameters

BindingType: Static. Must be “Table”.
ArrayPath: The array to create the table rows from.

Dynamic Table

Dynamic table can be defined with following binding:

{"BindingType": "DynamicTable", "BindingKey": "tableData" }

Description

This binding allows to control a table in terms of the amount of columns and rows as well as its formatting.

Parameters

  • BindingType – Static. Must be DynamicTable.
  • BindingKey – JSON object with a defined model representing the configuration of the table. Use Data Transformation to structure your data according to this model:

Model

  • Options (case sensitive, optional). Properties in the Options object define general properties for the table or its formatting. Currently we support only 1:
    • KeepTotalWidth (case sensitive, optional) – boolean parameter. Set to true if you want to keep the same width of the table as before processing. False or NULL means that width will not be preserved.
  • Headers (case sensitive, optional) – list parameter. If defined – it controls the amount of columns in the resulted table. It can either be hardcoded amount of objects or dynamic coming from another object (Jmes transformation). Each object defined in this parameter must contain a “Visible” parameter that controls the visibility of that column. If NULL, processing will not control the amount of columns in the table.
    • Visible – (case sensitive, required) – boolean parameter. Parameter that controls visibility of the existing or populated column. If set to true, it shows the column. If false – hides the column.
    • KeepWidth – (case sensitive, optional) – boolean parameter. Define if a column must preserve its width after processing. This parameter makes sense in cases of resizing table columns.
  • Rows (case sensitive, optional) – list parameter. If defined – it controls the amount of rows in the resulted table. It can either be hardcoded amount of objects or dynamic coming from another object (Jmes transformation). First object in the list defines the header values – if you wish to not change header values – define the object but leave empty. If the list size is larger than existing amount or rows – the processing will populate the last row to match the size from the list. If less – the processing will decrease the amount of rows. Each object can define unlimited amount of properties for the row.

Example of a JSON object that can define a dynamic table:

{
    "tableData":{
        "Options": {
            "KeepTotalWidth": true
        },
        "Headers" : 
        [{
             "Visible" : true 
         },
         {
             "Visible" : ValueFromMyData
         },
         {
             "Visible" : Value2FromMyData,
             "KeepWidth" : true
         }
        ]
        "Rows":
        [{
              "H1" : "Header value 1",
             "H2" : "Header value 2"
         },
         {
             "L1" : "Second row value",
             "L2" : "Second row value 2"
         } 
        ]
    }
}

CellRepeater

The binding must enclose the entire table, not just a row or a cell, but the entire table. The first cell in the table will be the template for the remaining cells, and the amount of cells in the first row, defines the amount of cells in rows added.

Depending on data, the processing will either expand the amount of cells or shrink them.

Syntax

{ "BindingType": "RepeatTableCells", "BindingKey": "sampleKey" } 

Parameters

BindingType: Static. Must be “RepeatTableCells”.
ArrayPath: JSON object with a defined model representing the configuration of the cell repeater.

Model

  • options (case sensitive, required) – defines the general options for cell repeater processing.
    • direction (case sensitive, required) – string parameter. Defines the direction of the cells to be expanded. Currently only “lrtb” is supported. (left-to-right, top-to-bottom)
  • cells (case sensitive, required) – list parameter. Data for cells.

Example of a JSON object following the model:

{
  "options": {
    "direction": "lrtb" 
  },
  "cells": [
    { "testkey": "firstValue" },
    { "testkey": "secondValue" }
  ] 
}