Working With Tabular Fields

Overview

Fields can contain tabular data, where each cell is treated as an independent link.  Tabular field data can come from a number of sources, including delimited field content, other data sources, HTML, XML, or built from conditional logic.

Example

In this example the field “AttributeValues” contains the following XML snippet:

The first stage is configure the field as ‘Tabular’ using field options, with the source as ‘Field Content’ and type ‘XML’.

Then transform the XML into a simple HTML table using a simple XSL statement, which define the contents of the tabular field:

Now the field shows as expandable in the EasyCatalog panel:

At this stage, individual cells, or the entire table can be inserted into a document and tracked.

How Links Work

Each cell is treated as a field in terms of tracking and updating.  The field is a ‘Computed Field’, linked to the ‘AttributeValues’ field,  but modified using a command which extracts data from a specific cell in the table. This is done via the  ‘TABLESTR’ command, which in the following example, extracts data from the top left cell:

compute-field

The parameters are the ‘Row ID’ and ‘Column ID’ as configured by the ‘Field Options’. It’s important these are carefully considered as they affect the ability to update the field.

Updating Tables

A typical use would be to insert part or all of a field as a table.   To do this, and keep it updated, first insert the entire ‘AttributeValues’ field into the document.  A table is created with the following settings, which are defined on the Table->Table Options… dialog box:

Populate Using Tabular Field

Field : AttributeValues

tabular-table

Once a table has been setup in this way it stays synchronised with the contents of the field. During the update process, EasyCatalog will insert or delete rows as necessary. Columns are updated based on the TABLESTR command used in the existing table, so it’s possible to be selective of the fields  in a table.

Additional Processing

Tabular fields provide a mechanism to manipulate the source table. This allows manipulation of both the table structure and content.  When executed, an object called ‘table’ is passed to the script, which can perform LUA based processing on it. For example, the following code returns a rotated version of the original table. For full documentation consult the LUA documentation.