EasyCatalog2p
Welcome to our EasyCatalog support site.
We help creative designers excel and automate with data driven content.
— Brian Cowell
contact@cunka.com

EasyCatalog Support Site

Training

Email us at contact@cunka.com and we can tailor training to suit your designers.

EasyCatalog Development Template

You can download all of our inhouse development tools for free.
EasyCatalog Training Template Download

About Us

Brian Cowell creates brochures, catalogues (1500+ pages with full indexes), manuals, and user documentation using InDesign and the EasyCatalog suite of plugins.

He has worked with creative designers for over 10 years transforming data sets to both print and interactive content. Has recently honed his skills in finding manual and automatic (Javascript/LUA) pagination solutions with EasyCatalog. Provides feedback & suggestions to 65bit.com to help the product grow.

EasyCatalog plugin modules used
  • Pagination module

  • Scripting module

  • XML Data Provider module

EasyCatalog skills
  • Template setup

  • Pagination Rules

  • Javascript programming (Adobe InDesign / EasyCatalog)

  • LUA programming (EasyCatalog)

  • XML data with XSLT transformations (Using Saxonica / with EasyCatalog)

  • EXCEL / CSV data (EasyCatalog)

  • Data taxonomy structures

  • Cleansing and preparing data for pagination

  • Training and mentoring EasyCatalog users

  • Regular Expression (REGEX) solutions

Perfion PIM database management - Administrator
Enterworks PIM/ DAM - Administrator

You can contact Brian at contact@cunka.com

Data Source Panel UPDATED

Shortcuts

The Data Source panel shortcuts using a combination of keys and mouse clicks.

MAC users should note the screenshots shown are from a PC. The magnifying glass icon on a PC will appear as a binocular icon your computer.
panel1
Number Short cut function

1

Ctrl+Alt + left mouse button
(on icon)

Opens every branch in the panel.

Repeating the process closes every branch in the panel.

2

Ctrl+Shift + left mouse button
(on icon)

Opens every branch in the selected branch of the panel.

Repeating the process closes every branch in the selected branch of the panel.

3

Shift+Alt + left mouse button
(on field header)

Hides the field.

4

Triple clicking the left mouse button
(on any panel branch)

Selects everything in the panel.

5

Ctrl+Alt (on Magnifing glass / Binoculars icon)

Removes any applied subsets.

6

Double clicking the left mouse button
(on panel head)

Panel is compressed to a tab only.

7

Double clicking the left mouse button
(on column seperator)

Auto sizes the column width to fit the largest content.

Preferences

The Data Source panel display can be configured to change its appearance from the Panel Preferences menu.

Right click anywhere in the Data Source panel to display a menu to select Panel Preferences.

panel2

The Panel Preferences allow you to control how the tool tips behave, as well as the preview size. There is also a checkbox to allow the configuration files to be displayed in the panel.

Tool Tips
  • None

  • Text Only

  • Text and Image Previews

Preview Size
  • Small

  • Medium

  • Large

  • Custom (180 px)

  • Custom (200 px)

  • Custom (220 px)

  • Custom (240 px)

  • Custom (260 px)

  • Custom (280 px)

  • Custom (300 px)

  • Custom (320 px)

  • Custom (340 px)

  • Custom (360 px)

  • Custom (380 px)

  • Custom (400 px)

  • Custom (420 px)

  • Custom (440 px)

  • Custom (460 px)

  • Custom (480 px)

  • Custom (500 px)

EasyCatalog Panel Preference Preview Size
Fig 1. Preview Sizes

Preview Size Examples

Hover over an image to size its size.

EasyCatalog Panel Preference SmallEasyCatalog Panel Preference MediumEasyCatalog Panel Preference LargeEasyCatalog Panel Preference 200xEasyCatalog Panel Preference 300x

panel3
Fig 2. Panel Preferences with "Show Configurations" selected

Here is an an example where the "Show Configurations" has been selected in the Panel Preferences. The configurations files are shown above the fields row

panel4
Fig 3. Panel Preferences shown with configuration files

Subset (Filtering)

Using a Subset

The Data Source panel view can be configured to filter data to meet a certain criteria. This is called a "Subset".

You can create and save as many "Subsets" as you need. They can be saved within your configuration file.

From an automation point of view, "Subsets" are very handy as it allows you control when and how the subset will be paginated.

The example below shows the subset built where it says only show if the class field contains the term Data Source

panel5

Example of what the panel looks like with the subset applied.

panel6

By selecting More Choices its possible to filter down on many more fields.

To quickly remove any applied subsets, simply hold the Alt key and left mouse click on the magnifying icon. (Binocular icon on a MAC)

panel7
Example 1 - Find "YES" in the field AAA

In this simple example, a panel is made up of various fields that contain the values "YES" and "NO".

The objective is to find all the fields with the value "YES" in the field AAA.

SubSet1

Clicking on the Magnifying Glass (Binocular icon on a MAC) will bring up the Subset menu. In the Parameter box we select the AAA field. Next the selection "Contains" is entered following the value of "YES".

So our subset formula says only show records if the field AAA contains the word YES

SubSet2

The number in the corner of the panel indicates how many records are shown from the total amount of records. In this example we are shown 5 out of 11 records.

SubSet3

Regular Expression Subset

The subset dialog allows the use of a regular expression to assist with filtering results.

Example 1 - Values beginning with 2 numerical digits

In this example a regular expression is used on the field SERIAL_NO that is looking for a value that begins with 2 numerical digits.

^\d{2}
SubSet4
Example 2 - Values ending with 2 numerical digits

In this example a regular expression is used on the field SERIAL_NO that is looking for a value that ends with 2 numerical digits.

\d{2}$
SubSet5
Example 3 - Values starting with "Y"

In this example a regular expression is used on the field SERIAL_NO that is looking for a value that starts with "Y".

^Y
SubSet6
Example 4 - Values ending with "SU"

In this example a regular expression is used on the field SERIAL_NO that is looking for a value that ends with "SU".

SU$
SubSet7
Example 5 - Values beginning with 3 numbers, a dash, then a "5"

In this example a regular expression is used on the field ISBN13_CODE that is looking for a value that begins with 3 numbers, followed by a dash, then the number 5.

^\d{3}-5
SubSet8

Synchronize a new Data Source

If you are using a static data source like an XML/Excel/CSV file, there may be times when you need to update the data source.

PERMANENT DATA LOSS !
This process overwrites the existing data.

To update the data source , you must hold down the Shift key when selecting the Synchronize with Data Source option. This will allow you to select the new updated source.

panel8

Sort by Appearance

The Sort by Appearance selection allows fields that have the Appearance attribute applied to be sorted and arranged.

Applying colors to field columns makes field navigation a lot easier.
EasyCatalog ReorderByAppearance 3
Before 'Sort by Appearance'
EasyCatalog ReorderByAppearance 2
After 'Sort by Appearance'
EasyCatalog ReorderByAppearance 4

Update Panel NEW

With Page Positions

Every records actual position on the document can be updated back into the data source panel.

Using the option With Page Positions…​ a records X and Y, as well as Height and Width can be updated and stored.

The X and Y positions of the actual frame containing the field will be used as the update in the data source panel. (NOT the position of the field within that frame).

This is handy if you need to track the position of records for any pagination that is required to be positioned.

Select With Page Positions…​ from the menu

Data Source Panel Menu → Update Panel → With Page Positions…​

EasyCatalog Panel WithPagePositions
EasyCatalog Panel WithPagePositions2
Search For
Field

Limit the update to searching for a specific field (rather than any field for the record) and whether only text fields , picture fields or both types should be searched for.

Field

Description:

All

All fields for the record will be searched for in the document.
When one is found, its position will be used to update the Update field.

Field Name

The document will be searched for the specified field name, and its position be used to update the Update field.

Content Type

Limit the update to searching for a specific frame type.

Content Type

Description:

All

Both text and picture boxes will searched for a field in the document for each record.

Text

Only text-based fields will be searched in the document.

Picture

Only picture fields will be searched in the document.

Update

Nominate the fields in the data source panel to be updated with the position/dimension of the Search For Field.

X Field, Y Field, Width Field, Height Field

Specified field(s) that holds the value for either positions or dimensions.

X Field
Y Field
Width Field
Height Field

Description:

Unspecified

No specified field has been nominated from the data source panel.

Field Name

A specified field from the data source panel that will have its value 'updated' that is either a position co-ordinate, or a dimension value.

Records

Determine whether all records, or a select amount from the data source panel will be updated.

Records

Description:

All

All records in the data source panel will be updated.

Panel Selection

Only records selected in the data source panel will be updated.

Relative To

Determine where the X/Y co-ordinates will be taken from.

Relative To

Description:

Page

The co-ordinates used to update the X and Y fields will be relative to the top-left of the frame is place on.

Origin

The co-ordinates used to update the X and Y fields will be relative to origin point on the ruler.

Example - Update X/Y positions for images

The field IMAGE places a picture into a frame.
The fields X_POSITION_IMAGE and Y_POSITION_IMAGE hold X/Y co-ordinates of the frames.

EasyCatalog Panel WithPagePositions3

Using With Page Positions…​
Data Source Panel Menu → Update Panel → With Page Positions…​

EasyCatalog Panel WithPagePositions4

The frames X/Y positions are updated and stored in the data source panel.

EasyCatalog Panel WithPagePositions5

Excluding Fields NEW

The data source in use may contain fields which are not actually required.
The result can cause data source panels to become complex and may require extra resources to maintain.

EasyCatalog 2023 now allows you to exclude fields permanently.

Errors and issues will occur if you apply Excluding fields incorrectly.
Make sure the fields you are excluding are NOT used in any dependents before applying. e.g. other fields, groups, scripts, rules..

To exclude a field or a set of fields permanently from a data source panel:

  • press the (i) info button

EasyCatalog Exclude Fields 1

Then click the icon at the top left of the information dialog box.

EasyCatalog Exclude Fields 2

This presents a dialog box similar to this.

EasyCatalog Exclude Fields 3

Fields with a green indicator are what is currently included in the data source panel.

To exclude a field, double click on the field text until the indicator turns red.

EasyCatalog Exclude Fields 4

You can search for fields using the search box on the bottom of the dialog box.

EasyCatalog Exclude Fields 5

Regular Expressions for Excluding Fields

Excluding fields can be done by using regular expressions to find fields that fit a certain naming pattern.

This allows you to quickly exclude groups of fields in an expression, rather then finding excluding each field individually.

To use a regular expression in the Excluded Fields dialog, use the Add button.

Example : Exclude all fields in the data panel that begin with T41

EasyCatalog Exclude Fields Regular Expression 1

In the Excluded Fields dialog box:

  • Press the Add button

  • Enter the Wild Card dialog box the Regular Expression: ^T41

EasyCatalog Exclude Fields Regular Expression 2

The ^T41 regular expression will appear at the top of the dialog box with a yellow box indicator.

  • Press the OK button

EasyCatalog Exclude Fields Regular Expression 3

The data source panel will need to be synchronized to apply the Excluded Fields settings.

  • Press the Synchronize button.

EasyCatalog Exclude Fields Regular Expression 4

Now that the data source panel is going to change, it will ask "Do you wish to continue?"

At this point you must make a decision whether you will make the change.
In this example for the data source panel I have :

  • Pressed the Yes button

EasyCatalog Exclude Fields Regular Expression 5

The data source panel will now display without the fields beginning with T41.

EasyCatalog Exclude Fields Regular Expression 6

Remove an applied Regular Expression applied for Excluding Fields

You may want to include fields that were previously removed with a regular expression.

The following example shows a regular expression applied that was excluding any fields that began with the name T41.

In the Excluding Fields dialog select the regular expression you wish to remove.

  • Press the Delete button

  • Press the OK button

EasyCatalog Exclude Fields Regular Expression 7

Even though the regular expression is now removed, the data source panel will need to be synchronized to complete the update changes.

  • Press the Synchronize button

EasyCatalog Exclude Fields Regular Expression 8

The fields will now appear in the data source panel.
Just be aware EasyCatalog will put them initially back at the end of the data source panel.

EasyCatalog Exclude Fields Regular Expression 9
To remove the red dashed boxes, go and Syncronize the data source panel again.

Record Viewer

The EasyCatalog Record Viewer displays a selected data source a single record at a time. The data appears vertically, making working with records containing a large number of fields easy.

Using the Record Viewer, you can view individual records, quickly filter and place your data on the page.

In addition, to help identify fields already placed in the document, the Record Viewer panel can also show the record(s) in the current document selection.

EasyCatalog Record Viewer1

Opening the Record Viewer

If the Record Viewer panel is not visible, show it using the Window  →EasyCatalog Record Viewer menu option.

EasyCatalog Record Viewer

Overview

The top dropdown box is where you select the Data Source records you wish to use.

Make sure you have selected the right Data Source. If you have many similar data source panels, its easy to be looking at the wrong one.

The Find text box helps you find records through filtering.

The pencil icon on the bottom left corner of the Record Viewer allows to insert selected field into the document.

Bottom row allows you to scroll through the records.

Be aware it is NOT a text scroll bar, its a records scroll bar.
EasyCatalog Record Viewer0

Finding Records

EasyCatalog Record Viewer offers a number of ways to step through the records from you data source, and can also filter the records shown based on the content of their fields.

The records shown when stepping using the scroll-bar/arrow buttons, can be filtered by entering search criteria into the Find text box.

To search for an exact match, enter the search term in double quotes.
Eg. "11"

Results are in yellow highlighting.

Key Fields

Will search the data source key field(s).
Key fields are unique indentifiers used to distinguish records.
Eg. ID, Model

EasyCatalog Record Viewer2
Text

Will search all fields.
Does not find text in tables.

EasyCatalog Record Viewer3
Expression

Enter a regular expression into the Find field.
Will search the data source key field(s).

Table 1. Examples
Regular Expression Details

^YZ6

Shows all records beginning with ‘YZ6’

Z$

Shows records ending with ‘Z’

^Y.*S$

Shows records that begin with ‘Y’ and end with ‘S’

6.1

Shows all records that contain ‘6’ followed by any character followed by ‘1’

.*11

Shows all records that contain ‘11’

EasyCatalog Record Viewer4
Find key fields that begin with YZ6
^YZ6
EasyCatalog Record Viewer5
Find key fields that conatin 11
.*11
EasyCatalog Record Viewer6
Find key fields that end with Z
Z$
EasyCatalog Record Viewer7
Selection

The fields in the current document selection will be shown in the panel. The names of the selected fields will be highlighted in yellow in the Record Viewer panel.

EasyCatalog Record Viewer8
Range

Enter a numeric range of record index numbers into the ‘Find’ field. Ranges and single index numbers are allowed - for example: 1,2,10-20 will display records 1, 2 and 10 thru 20 (inclusive) in the panel.

EasyCatalog Record Viewer9

Keyboard Short Cuts NEW

InDesign has a long list of keyboard short cuts that can be applied to enhance user productivity.

EasyCatalog continues the list of short cuts available bringing the many commands features that exist only in menus into an actual keyboard function.

By default EasyCatalog keyboard short cuts are never set up.

EasyCatalog Short Cuts

Short Cut Setup

The EasyCatalog keyboard short cuts can be found within the InDesign short cuts.

InDesign Menu:

  • Edit  Keyboard Shortcuts..  Product Area EasyCatalog

EasyCatalog Short Cuts 1

If you are unsure of any existing short cuts that both InDesign and EasyCatalog are using:

  • Press the Show Set…​ button to see a generated text file listing of short cut assignments

EasyCatalog Short Cuts 2

Default Short Cut Settings

Here is the list of default Commands that EasyCatalog can assign along with the keyboard short cut assignments.

By default the keyboard short settings are empty and await a user to set up.

Commands Keyboard Short Cut

Adopt Selection

no short cut

Auto Fill Tables

no short cut

Auto Pickup

no short cut

Cell Finder

no short cut

Change Document Keys

no short cut

Create Records For Untagged Text

no short cut

Edit Field Content

no short cut

Insert Field

no short cut

Key Finder

no short cut

Lock/Unlock Selection

no short cut

Make Panel Containing Selection

no short cut

Markup Field

no short cut

Markup Multiple Fields

no short cut

New Panel From Template 1

no short cut

New Panel From Template 2

no short cut

New Panel From Template 3

no short cut

New Panel From Template 4

no short cut

New Panel From Template 5

no short cut

Paginate…​

no short cut

Quick Search Selection

no short cut

Relink Selected Tags to Selected Fields

no short cut

Remove Field Markers

no short cut

Replace Fields in Selection

no short cut

Select Related Objects

no short cut

Select Text Between Markers

no short cut

Set Focus To Quick Search

no short cut

NEW Show All

no short cut

NEW Show Subset…​

no short cut

Synchronize With Data Source

no short cut

Toggle Field Markers

no short cut

Update Content For All Keys

no short cut

Update Data Source With Document Selection

no short cut

Update Document

no short cut

Update Document With Panel Selection

no short cut

Update Furniture on Selected Pages

no short cut

Update Panel

no short cut

Update Selection

no short cut

Update XML Tags With Record Selection

no short cut

Combined Data Sources

EasyCatalog now allows you to combine separate data sources into a single panel through a feature called a Combined Data Source.

EasyCatalog Combined Data Sources 1
Go to our detailed explanation and example page

Combined Data Sources

Advanced Preferences

The EasyCatalog Preferences panel provides access to additional Advanced Preferences panel that allow you to tailor settings to your environment.

InDesign is required to be relaunched to apply any changes.

Locating the Panel

The Advanced Preferences panel can be found by going to the InDesign menu Edit→Preferences then selecting EasyCatalog…​

EasyCatalog Preferences 2

Select Advanced…​ to view the Advanced Preferences panel.

EasyCatalog Preferences 3

Settings

EasyCatalog v16.23859 settings are displayed and listed.
EasyCatalog Preferences 1

Workspace

Setting Description

Multi User Workspace

Defines the the default setting when the preferences are rebuilt.

Cache Formatted Data

true = EasyCatalog stores the ‘formatted’ content of a field for quicker data source loading.

false = The formatted content is rebuilt when the data sources is loaded.

Default Workspace Folder

This is the default setting applied when the preferences are rebuilt.

Lock Workspace Prefs

Prevents users making changes to the general Preferences.

HTTP

Allows modification of the default settings used for HTTP requests via CURL.

Setting Description

CURL Low Speed

Set low speed limit time period.
https://curl.se/libcurl/c/CURLOPT_LOW_SPEED_TIME.html

CURL Low Speed

Limit Set low speed limit in bytes per second.
https://curl.se/libcurl/c/CURLOPT_LOW_SPEED_LIMIT.html

CURL Timeout

Set maximum time a request is allowed to take.
https://curl.se/libcurl/c/CURLOPT_TIMEOUT.html

Field Markers

Setting Description

Image Frame Label

The default Frame Label can be replaced with a custom value using commands such as FIELDSTR(FieldX).
Has a negative impact of screen drawing.

Print Field Markers

true = Field markers will print. Use with caution!

false = Field markers will NOT be printed. (This is the default setting)

Ignore Unknown Fields

true = When populating field specifiers, if the field specifier/field is for a field that does not exist in the record being paginated it will be ignored. The field will also be ignored during Adopt Fields. (This is the default setting)

false = When populating field specifiers, if the field specifier/field is for a field that does not exist in the record being paginated the content of the field will be cleared and the field markers updated to link to the unknown field.

Menu

Setting Description

Geometry Menu Option

Enable or disable menu options relating to the Geometry functionality

Miscellaneous

Setting Description

Auto Purge Deleted

true = Will purge any deleted records automatically after each Synchronise with Data Source operation.

false = Is the default setting.

Mixed Placed Group Error

true = If a group contains a mix of placed and unplaced records, it will be shown in an error state.

false = Is the default setting.

Update Tabular Field Structure

default, always and never.
Override the default behaviour of how tabular fields are updated.

Live Quick Search

Returns results as you type into the search area part of the panel. This setting is on by default.

You can turn off ‘as you type’ searches in the quick search area of the data panel. Searches via this method return values when the Enter key is executed. This setting is useful for searching thousands of records.

Process Custom Fields Of Deleted

Process custom fields of deleted records.

New Custom Field Appearance

Applies a default drawing style to new custom fields.
By default this selection is empty.
This is handy way to give custom fields a background color as they are created.

Pasting this example LUA code gives custom fields a gold color.

setopacity(0.5)
setcolor(255,255,79.05)
drawrect(x,y,width,height)

Download Image Previews

Downloads a URL based image in order to generate a preview.

Default setting is true.

Enhanced Dependency Checking

Provides in depth custom field dependency checking with enhanced reporting in the event of a cyclic dependency.

Default setting is true.

Highlight Document Selection

Highlights the selected fields in a document using a blue outline in a data panel.

Default setting is false.

Report Format

Defines the export format when using the Reports creation feature.
Default setting is the users browser.

Other export formats that can be used are excel, csv, and xml.

Formatting Rules

Setting Description

Populate Formatting Rules on Drop

This is the default setting for "Populate on Drag 'n' Drop" for formatting rules.

Default setting is false.

LUA

Setting Description

Enable Sockets

false = the default setting.

true = Enables LuaSocket library support. Must be enabled for debugging of Lua code. Can be detrimental to performance!
Recommended for debugging LUA code purposes only.

Process Text Content

Any text between the Start Marker and End Marker is treated as Lua code, executed when the text is updated.

Default setting is true.

Start Marker

Defines the start marker used for embedded Lua code.
Default is [[.

End Marker

Defines the end marker used for embedded Lua code.
Default is ]].

Use Threads

Use Lua threads to speed up the execution of advanced custom fields.

Default setting is true.

Setting Description

Status Poll Delay (seconds)

Control the frequency of checks for URL (Live) Links.

Periodic checks are made by InDesign to check if an image has changed size. This delays those request to prevent server overload.

Default setting is 0.

File

Setting Description

Fieldsep

Default setting ","

Recordsep

Default setting ","

Format

Default setting ASCII

Header

Default setting true

XML

Setting Description

Filepath

Recordxpath

Sourceurl

Format

Default setting file

Updatetype

Default setting all

Allowupdates

Default setting false

Updateurl

Datasourcename

User

Password

Authenticate

Default setting false

Import/Export Settings

The Advanced Preferences panel settings can be saved and reloaded when required.

The Export…​ button will save all the Advanced Preferences to a file. (XML format)

The Import…​ button allows any previously exported Advanced Preferences to be reloaded.

EasyCatalog Preferences 4

Reset Settings

Settings in the Advanced Preferences panel can be reset to the default settings used by EasyCatalog.

When a value is changed, its attribute and attribute value are displayed with bold text and an underline.

EasyCatalog Preferences 5

Reset One Attribute

To reset the value of a single attribute, select the attribute, and the greyed out Reset button will now be enabled.

Press Reset to restore back to the default setting.

EasyCatalog Preferences 6

Reset All Attributes

To reset all the changed values, select the attributes folder and the greyed out Reset button will now be enabled for use.

Press Reset to restore all the attributes under that folder back to their default settings.

EasyCatalog Preferences 7

Export CSV / Excel File

EasyCatalog allows you to easily export all the data from an existing data source panel to CSV or Microsoft Excel file formats.

CSV File

Hold down Shift+Alt (Windows) when selecting “Update Data Source” to output a CSV file.

ReportExport2

Excel File

Hold down Shift+Ctrl (Windows) or Shift+Cmd (Mac) when selecting “Update Data Source” to export an Excel file containing the data source’s data rather than a CSV file.

Does not include custom fields.
You will find this actually works if you hold either Shift … or Ctrl or Alt on a PC as well.

Reports

EasyCatalog can generate helpful data reports of the
  • data source

  • the panel

  • document (front-most document)

Reports can be created in
  • web browser (this is the default setting)

  • EXCEL file format

  • CSV file format

  • XML file format

This can be useful in assisting your maintenance of templates and libraries and understanding where fields/data have been placed.

An additional option called "Custom Report" is also available via Lua code scripting.

All reports are stored in the EasyCatalog Workspace folder.

Report Preferences

Reports can be generated in EXCEL / CSV / XML file formats, or viewed directly in the web browser.

Default setting is web browser.

InDesign Menu → Edit → Preferences → EasyCatalog…​ → Advanced…​
  • Report Format (under Miscellaneous heading)

EasyCatalog Report Preferences 1
EasyCatalog Report Preferences 2

Selecting Reports

To create a report, select the panel and right click the top right corner → Reports. Then select the report type.

ReportExport4

Data Source Report

This report shows all records and fields in the data source in a similar format to the EasyCatalog data panel.

If the record or field is placed on the front-most document it will be shown in red or green to show its status.

ReportExport6

Panel Report

This report will shown only the records that are in the panel. They will appear in the same order as the panel obeying any sorting, grouping and filtering options you have configured.

If the record or field is placed on the front-most document it will be shown in red or green to show its status.

ReportExport3

Document Report

Page Number

Page number/master pages

Datasource

Panel datasource name

Key

Key value (usually the ID key)

Field

Field name

Content

For text it’s the field value, if it’s an image it’s the image path and file name.

Notes

Text saved under the Notes tab. If no text the default is to show the Field value again.

ReportExport7

Custom Report

Through LUA code, the custom report option provides a mechanism for a programmer to inspect a data source, panel or document, and output the information in virtually any format.

All your custom reports can be saved under a unique name to the “Report Menu” for later use, or to be later recalled from the menu for editing.

CustomReport

Saved "Custom Reports" can then appear in the menu.

CustomReport2
Custom Reports exist only in the EasyCatalog Workspace they are created in. You will need to copy them to other workspaces for use.
CustomReport3

Create a Custom Report

Creating a custom report in EasyCatalog is straight forward. The caveat with LUA is you must first save a file before it can be opened in the browser.

This example uses LUA in EasyCatalog to save a basic HTML file and open it in the browser.

EasyCatalog Custom Report browser
Fig 4. Full LUA code used in Sublime Text
-- Save a file to the users document folder
function writefile(filename, value)
  if (value) then
    local file = io.open(filename,"w+")
    file:write(value)
    file:close()
  end
end

-- Create the HTML Code
-- Very basic HTML page
page = [[<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>CUNKA - Custom Reports</title>
  </head>
  <body style="background-color: aliceblue">
    <h1>My Custom Report</h1>
    <p>Creating custom reports to display in the users default browser with EasyCatalog using LUA.</p>
    <p>by Brian Cowell</p>
  </body>
</html>]]

-- Save the file
writefile("CUNKA.html", page)

-- Open the saved file in the default browser
os.execute('start "" "CUNKA.html"')

The result is this simple page.

EasyCatalog Custom Report test0

This is a screen shot of a more advanced report that is using Bootstrap 4 and displaying the environment variables.

EasyCatalog Custom Report test1

Editing The Report CSS Styling

The Data Source, Panel and Document reports are generated from EasyCatalog firstly as a XML file. The XML file calls the transformation file (called xslt.xml) that creates the final HTML document which is opened in your default web-browser.

The generated XML files and the xslt.xml file can be found in the EasyCatalog Reports folder inside of your EasyCatalog Workspace folder.

Here is the code of the xslt.xml file showing where you can edit the CSS colored red.

xslt.xml

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<html>
			<head>
				<style type="text/css">
					table,td
					{
						border: 1px solid #CCC;
						border-collapse: collapse;
						font: small/0.9 "Tahoma", "Bitstream Vera Sans", Verdana, Helvetica, sans-serif;
					}
					table
					{
						border :none;
						border :1px solid #CCC;
					}
					thead th,
					tbody th
					{
						background : #DDD repeat-x;
						color : #666;
						padding : 2px 2px;
						border-left : 1px solid #CCC;
					}
					tbody th
					{
						background : #fafafb;
						border-top : 1px solid #CCC;
						text-align : left;
						font-weight : normal;
					}
					tbody tr td
					{
						padding : 5px 10px;
						color : #666;
					}
					tbody tr:hover
					{
						background : #FFF  repeat;
					}
					tbody tr:hover td
					{
						color : #454545;
					}
					tfoot td,
					tfoot th
					{
						border-left : none;
						border-top : 1px solid #CCC;3
						[red]#padding : 4px;
						background : #FFF  repeat;
						color : #666;
					}
					caption
					{
						text-align : left;
						font-size : 120%;
						padding : 10px 0;
						color : #666;
					}
					table a:link
					{
						color : #666;
					}
					table a:visited
					{
						color : #666;
					}
					table a:hover
					{
						color : #000;
						text-decoration : none;
					}
					table a:active
					{
						color : #003366;
					}
					p.special
					{
						color : green;
						border : solid red;
					}
                    td.uptodate {
						background-color : #ccffcc;
					}
                    td.outofdate {
						background-color : #ffbbbb;
					}
				</style>
			</head>
            	<body>
				<table border="1" width="100%">
					<caption>
						<xsl:value-of select="easycatalog/@title"/>,
						<xsl:value-of select="easycatalog/@datetime"/>,
						<xsl:value-of select="easycatalog/@version"/>
					</caption>
					<thead>
						<tr>
						<xsl:for-each select="//entry[@index=1]">
							<xsl:for-each select="keyvalue">
								<th scope = "col"><xsl:value-of select="@key"/></th>
							</xsl:for-each>
						</xsl:for-each>
						</tr>
					</thead>
						<xsl:for-each select="//logentries">
							<xsl:if test="@name[not(.='')]" >
								<tr>
									<td colspan = "999" bgcolor="#EEE" ><b><xsl:value-of select="@name"/></b></td>
								</tr>
							</xsl:if>
							<xsl:for-each select="entry">
								<tr>
									<xsl:for-each select="keyvalue">
										<td>
  											<xsl:attribute name="class">
    												<xsl:value-of select="@docstate" />
 											</xsl:attribute>
 											<xsl:value-of select="@value"/>
										</td>
									</xsl:for-each>
								</tr>
							</xsl:for-each>
						</xsl:for-each>
					</table>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

Field Options

Field Options allow a fields text (or images) to be formatted before it is placed in a document.

You can format the field to be:

  • A certain data type
    e.g. alphanumeric, number, date/time, hyperlink, currency, barcode…​

  • Additionally cleansed and styled
    e.g. remove and replace unwanted text, apply an InDesign Character style to the contents

  • Placing an image
    e.g. its location (Folder/URL), scaling, position, alignment

  • Retrieved from a database
    e.g. set up attributes to connect to the database

  • Viewed in the data source panel using colors
    e.g. use a color to show image fields

  • A new field with custom content
    e.g. using a custom field to join the contents of other fields

By setting Field Options you can, for instance, ensure that your price fields are formatted to use the correct currency symbol and number of decimal places.

To find more detail on Field Options go to our dedicated Field Options page:

EasyCatalog Field Options

Format UPDATED

See our page for Format: Format

General

See our page for General: General

Picture Content

See our page for Picture Content: Picture Content

Advanced

See our page for Advanced: Advanced

Database Update

See our page for Database Update: Database Update

Appearance

See our page for Appearance: Appearance

Custom Field

See our page for Custom Field: Custom Field

Notes

See our page for Notes: Notes

Preprocessing

See our page for Preprocessing: Preprocessing

Date/Time

By selecting the "Date/Time" as the Format for a field, you can set how the time should be formatted.

Specifiers for Date & Time

The format of the date/time stamps in the existing source data can be changed to anything you may need.

Any time and date can be broken down individually to what is known as a ‘specifier’. Each ‘specifier’ begins with a '%' sign followed by a letter that. E.g. a full year like 2019 is represented by %Y.

By combining a series of specifiers together, its possible to indicate the format of any date or time. In order to that we need to know the:

  • Input Format - original source data

  • Output Format - desired display

Date Time2
Example - 17 June 2019

In this example we want to change the original date stamp of 17-06-2019 to 17 June, 2019

The - character is important. In this example it is the seperator and is part of this particular date stamp format. Your date stamp could have a / or a : as a seperator. (Even a space character)

Input Format

  • %d = 17

  • %m = 06

  • *Y = 2019

%d-%m-%Y

Output Format
* %d = 17
* %B = June
* *Y = 2019

%d %m, %Y
The output uses the space & comma characters between the 'specifiers'.

List of Specifiers

Specifier Description Example

%d-%m-%y %H:%M:%S

Year represented by 2 digits.
day-month-year hours:minutes:seconds

17-06-19 09:11:47

%Y-%m-%d %H:%M:%S

Year shown in full.
year-month-day hours:minutes:seconds

2019-06-17 09:11:47

%y-%m-%d %H:%M:%S

Year represented by 2 digits.
year-month-day hours:minutes:seconds

19-06-17 09:11:47

%d/%m/%Y

day/month/year

17/06/2019

%m/%d/%Y

month/day/year

06/17/2019

%d/%A/%Y

day/abbreviated weekday name/year

06/Mon/2019

%Ec

Current date&time on your computer

6/17/2019 9:11:47AM

%a

Abbreviated weekday name

Thu

%A

Full weekday name

Thursday

%b

Abbreviated month name

Aug

%B

Full month name

August

%c

Date and time representation

Thu Aug 23 14:55:02 2001

%C

Year divided by 100 and truncated to integer (00-99)

20

%d

Day of the month, zero-padded (01-31)

23

%D

Short MM/DD/YY date, equivalent to %m/%d/%y

08/23/01

%e

Day of the month, space-padded ( 1-31)

23

%F

Short YYYY-MM-DD date, equivalent to %Y-%m-%d

2001-08-23

%g

Week-based year, last two digits (00-99)

01

%G

Week-based year

2001

%h

Abbreviated month name (same as %b)

Aug

%H

Hour in 24h format (00-23)

14

%I

Hour in 12h format (01-12)

02

%j

Day of the year (001-366)

235

%m

Month as a decimal number (01-12)

08

%M

Minute (00-59)

55

%n

New-line character (‘\n’)

%p

AM or PM designation

PM

%r

12-hour clock time

02:55:02 pm

%R

24-hour HH:MM time, equivalent to %H:%M

14:55

%S

Second (00-61)

02

%t

Horizontal-tab character (‘\t’)

%T

ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S

14:55:02

%u

ISO 8601 weekday as number with Monday as 1 (1-7)

4

%U

Week number with the first Sunday as the first day of week one (00-53)

33

%V

ISO 8601 week number (00-53)

34

%w

Weekday as a decimal number with Sunday as 0 (0-6)

4

%W

Week number with the first Monday as the first day of week one (00-53)

34

%x

Date representation

08/23/01

%X

Time representation

14:55:02

%y

Year, last two digits (00-99)

01

%Y

Year

2001

%z

ISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100)
If timezone cannot be determined, no characters

+100

%Z

Timezone name or abbreviation
If timezone cannot be determined, no characters

CDT

%%

A % sign

%

Prefix for other languages

Dates can now be prefixed for other spoken languages.

Month and weekday names can be localised when formatting dates. By default they will use the language specified by the InDesign user interface, but this can be changed by prefixing the format with the language required.

[fr_FR]
Example 1 - French language prefix [fr_FR]
[fr_FR]%d %B %Y
%d-%m-%Y [fr_FR]%d %B %Y

11-04-2019

11 avril 2019

23-01-2019

23 janvier 2019

05-03-2019

05 mars 2019

Date Time1
Example 2 - English prefix [en_US]
[en_US]%d %B %Y
%d-%m-%Y [en_US]%d %B %Y

11-04-2019

11 April 2019

23-01-2019

23 January 2019

05-03-2019

05 March 2019

Example 3 - German prefix [de_DE]
[de_DE]%d %B %Y
%d-%m-%Y [de_DE]%d %B %Y

11-04-2019

11 April 2019

23-01-2019

23 Januar 2019

05-03-2019

05 Marz 2019

Example 4 - Danish prefix [da_DK]
[da_DK]%d %B %Y
%d-%m-%Y [da_DK]%d %B %Y

11-04-2019

11 april 2019

23-01-2019

23 januar 2019

05-03-2019

05 marts 2019

Example 5 - Spanish prefix [es_ES]
[es_ES]%d %B %Y
%d-%m-%Y [es_ES]%d %B %Y

11-04-2019

11 abril 2019

23-01-2019

23 enero 2019

05-03-2019

05 marzo 2019

Formatted Text (HTML)

"Standard" & "Enhanced" HTML Parsers

When field content contains formatting information, the 'Formatted' option instructs EasyCatalog to apply the formatting tags defined in the ‘Field Formatting Tags’ dialog.

TagsInFieldx1

The 'Standard' setting is a legacy method of providing basic HTML tag support in EasyCatalog. It simply looks for tag matches in the ‘Formatting Tags’ settings. It doesn’t work as a proper HTML parser so its possible to have unbalanced tags. End tags can just be used and it really doesn’t understand the difference between start and end tags. So while it still exists, its best to use the 'Enhanced' settings as the creators of Easycatalog intend to phase out its use in the future.

TagsInFieldx3
Fig 5. HTML set to "Enhanced"

The 'Enhanced' setting utilizes a proper HTML parser and maps character or stylesheet names to tag names. It applies a style for the range of a tag. It also balances tags and will tidy up bad HTML. It does not rely on the settings in Formatting Tags. When a field is updated the text is deleted, so whatever styles are at play after that will be applied to the new content. We recommend prefixing the field with a <normal> (or similar) character stylesheet so this is the first thing applied to the field when updated. This ‘cleans’ the residual formatting out.

TagsInFieldx2
Fig 6. Portion of HTML tags used in "Enhanced"
TagsInField 12
Fig 7. Prefixing the field with a <normal> character stylesheet

Enhanced HTML Features

Before any processing begins, the "Enhanced" HTML parser corrects any unbalanced tags and the entire field is enclosed within an implied <body> node.

Any HTML tag which matches the name of an InDesign Character or Paragraph style will apply that style.

Tag

Attribute

Value

footnote

-

e.g. Available in most sizes. <footnote>Note 1</footnote>

font

face

Font name

e.g. <font face="Arial">CUNKA - EasyCatalog Experts

size

Font size

e.g.

color

Swatch name
Can be a Swatch name or a cmyk value.

e.g. <font color="CUNKA_LAWN">CUNKA - EasyCatalog Experts
e.g. <font color="c15m100y100k0">CUNKA - EasyCatalog Experts

p

shade

Paragraph shade
Can be a Swatch name or a cmyk value.

e.g. <p shade="CUNKA_LAWN">CUNKA - EasyCatalog Experts
e.g. <p shade="c100m0y0k0">CUNKA - EasyCatalog Experts

align

left,right,center,justify

e.g. <p align="right">CUNKA - EasyCatalog Experts
e.g. <p align="center">CUNKA - EasyCatalog Experts
e.g. <p align="justify">CUNKA - EasyCatalog Experts

style

Paragraph style name

e.g. <p style="CunkaBIG">CUNKA - EasyCatalog Experts

a

href

URL

e.g. <a href="https://www.65bit.com/">Creators of EasyCatalog

img

src

Filename or full path to an image

e.g. <img src="Pattern1.jpg"/>
e.g. <img src="C:\Users\Cunka\Documents\EasyCatalog Workspace\CUNKA Test Panel\Images\Pattern1.jpg"/>

clippingpath

Clipping path name
Uses a clipping path name applied from Adobe Photoshop.

e.g. <img src="Pattern11.jpg" clippingpath="PATH1"/>

fitting

contentaware,frametocontent

e.g. <img src="Pattern11.jpg" fitting="contentaware"/>
e.g. <img src="Pattern11.jpg" fitting="frametocontent"/>

url

URL

e.g.

shape

ELLIPSE,TRIANGLE,POLYGON

e.g. <img src="Pattern1.jpg" shape="ELLIPSE"/>
e.g. <img src="Pattern1.jpg" shape="TRIANGLE"/>
e.g. <img src="Pattern1.jpg" shape="POLYGON"/>

swatch

Swatch name
Can be a Swatch name or a cmyk value.

e.g. <img src="fa-fighter-jet.png" swatch="c100m0y0k0"/>
e.g. <img src="fa-fighter-jet.png" swatch="CUNKA_LAWN"/>

width

Value in points or string with unit of measure

e.g. <img src="fa-fighter-jet.png" width="10"/>
e.g. <img src="fa-fighter-jet.png" width="100px"/>
e.g. <img src="fa-fighter-jet.png" width="10mm"/>
e.g. <img src="fa-fighter-jet.png" width="50pt"/>

height

Value in points or string with unit of measure

e.g. <img src="fa-fighter-jet.png" height="5"/>
e.g. <img src="fa-fighter-jet.png" height="50px"/>
e.g. <img src="fa-fighter-jet.png" height="5mm"/>
e.g. <img src="fa-fighter-jet.png" height="200pt"/>

style

Object style name

e.g. <img src="tristan-gassert-674119-unsplash.jpg" style="TWO"/>

EasyCatalog EnhancedParser2
Fig 8. Using <p> tag with attributes
EasyCatalog EnhancedParser3
Fig 9. Using <a href> tag for hyperlinks
EasyCatalog EnhancedParser4
Fig 10. Using <img> tag with "src" and "shape" attributes
EasyCatalog EnhancedParser5
Fig 11. Using <img> tag with "swatch" attribute
EasyCatalog EnhancedParser6
Fig 12. Using <img> tag with "width" attribute
EasyCatalog EnhancedParser7
Fig 13. Using <img> tag with "height" attribute

Tags to apply Paragraph/Character Styles

When Formatted is selected in the Format tab of field options, EasyCatalog will try to match any HTML style tag to the name of either an InDesign paragraph style, or an InDesign character style, and then apply it.

Example code:

<p><CUNKA_heading>CUNKA  - Tags inside a field</CUNKA_heading></p>
<p><CUNKA_body>We can use Paragraph / Character styles tags to control formatting.</CUNKA_body></p>
<p><CUNKA_body>Just like we are using here !!!!!</CUNKA_body></p>
<p><CUNKA_body>It is made up of 2 Paragraph styles.</CUNKA_body></p>
<p><CUNKA_body>The first one is the magenta coloured paragraph style called “CUNKA_heading”</CUNKA_body></p>
<p><CUNKA_body>The second bulleted paragraph style is called “CUNKA_body”</CUNKA_body></p>
TagsInField 14
Fig 14. Field specifier on the page
TagsInField 15
Fig 15. Paragraph styles applied

Allow All Whitespace

Text can come with white space that may be included intentionally. EasyCatalog has the setting Allow All White Space to handle such scenarios.

Example

Consider the following HTML code that has white space between the HTML tags.

<h1>Power Tools</h1>



<h3>Angle Grinders</h3>



<p>The <strong>CUNKA</strong> range of angle grinders are our most popular range featuring both high performance and long life.</p>

The custom field whitespace contains the HTML code.

EasyCatalog Whitespace1

Selecting "Enhanced" brings up the "HTML Options dialog".

You can now chose Allow All White Space, or deselect it.

EasyCatalog Whitespace2

The following shows the setting Allow All White Space both selected and unselected.

EasyCatalog Whitespace3

Cleansing

Applying Cleansing Options UPDATED

The content of each field can be cleansed in a non-destructive way before it is used in the document. This allows content to be changed, formatted or removed.

The Cleansing Options action acts like a simple search-and-replace function.

{replace this} = {with this};

The Data Source Panel always displays the data cleansed.

Removing the applied Cleansing Options restores the original field content.

Since the "=" symbol is used for the actual cleansing, if any data contains an equals sign, you must use two of them together. eg. <table>=<table style=="CUNKA_GOLD">

Example 1 - Simple Cleansing

All # characters are replaced with a $
Cleansing functions end with and are separated by a ;

#=$;
Before Cleansing After Cleansing

#3000

$3000

#20.10

$20.10

Example 2 - Multiple Cleansing

All # characters are replaced with a $
All _ characters are replaced with a .
Cleansing functions end with and are separated by a ; character

#=$;_=.;
Before Cleansing After Cleansing

#3000_00

$3000.00

#20_10

$20.10

Example 3 - Removing Characters

All # characters are removed
Cleansing functions end with and are separated by a ; character

Specify nothing on the right-hand side of the = cleansing option strips the character on the left.
#=;
Before Cleansing After Cleansing

#CUNKA

CUNKA

20#

20

Example 4 - Replacing strings

All CUNKA characters are removed
Cleansing functions end with and are separated by a ; character

CUNKA=EasyCatalog;
Before Cleansing After Cleansing

Email us at CUNKA

Email us at EasyCatalog

Call the CUNKA hotline

Call the EasyCatalog hotline

CUNKA

EasyCatalog

Example 5 - Fixing HTML

All <table tags are inserted with style="cunkaFruity"
Cleansing functions end with and are separated by a ; character

The == duplication of the equals sign must be used if the equal sign is needed in the cleansed result.
<table=<table style=="cunkaFruity";
Before Cleansing After Cleansing

<table>

<table style="cunkaFruity">

Example 6 - Replace empty data with a message

Sometime you may want to indicate that a field contains no information. Take for example images that may be required to all have a caption. When the caption field is empty you would like to say on the page Missing Caption!

Using REGEXV2, the ^ character means from the start.
The $ character means from the end.

Since there is no characters at the beginning and end, the empty field will have the Missing Caption! applied.

REGEXV2:^$=Missing Caption!;
Before Cleansing After Cleansing

Missing Caption!

Example 7 - Fixing "%" Encoding

URL "%" encoding ("%" followed by two hexadecimal digits) can sometimes appear in HTML code. One of the most regular seen is %20 which replaces space characters in text.

  • %3c = <

  • %20 = space

  • %3e = >

%3c=<;%20= ;%3e=>
Before Cleansing After Cleansing

%3cBR%20%3e

<BR >

Example 8 - Replacing spacing to include "%20" URL encoding NEW

URLs cannot contain spaces.
The encoding for a space character for a URL usually %20. (or +)
Cleansing functions end with and are separated by a ; character.

 =%20;
Before Cleansing After Cleansing

yourwebsite.com/picture .jpg

yourwebsite.com/picture%20%20%20.jpg


InDesign Metacharacters/Special Characters

InDesign metacharacters, such as those used in the Find/Change dialog, can also be used as part of the cleansing statement and within the prefix and suffix fields.

Metacharacters begin with a caret (^) and represent special characters in InDesign, such as a bullet point or a tab.

Characters not covered could possibly be handled through the use og REGEXV2.
See our sections Insert Unicode Characters and Using Regular Expressions UPDATED for more information.

Metacharacters Table

Table 2. A full list of metacharacters supported by EasyCatalog.
Code Description Character

^#

Auto Page Numbering

^x

Section Marker

^8

Bullet

^^

Caret

^

^2

Copyright Symbol

©

^p

End of Paragraph

^n

Forced Line Break

^7

Paragraph Symbol

^r

Registered Trademark Symbol

®

^6

Section Symbol

§

^t

Tab

^\

End Nested Style

^y

Right Indent Tab

^i

Indent to Here

^_

Em Dash

^m

Em Space

^=

En Dash

^>

En Space

^f

Flush Space

^|

Hair Space

^s

Nonbreaking Space

^<

Thin Space

^-

Discretionary Hyphen

^~

Nonbreaking Hyphen

-

^{

Double Left Quotation Mark

^}

Double Right Quotation Mark

^[

Single Left Quotation Mark

^]

Single Right Quotation Mark

^k

Discretionary line break

Example 1 - Asterisks Converted To InDesign Bullet Points

All asterisk characters * are converted to the InDesign bullet point metacharacter ^8
Cleansing functions end with and are separated by a ; character.

*=^8;
Before Cleansing After Cleansing

*cunka.com

  • cunka.com

*cunka.com
*65bit.com
*unsplash.com

  • cunka.com

  • 65bit.com

  • unsplash.com

Example 2 - Removing Forced Line Breaks

All forced line breaks characters ^n are removed.
Cleansing functions end with and are separated by a ; character.

^n=;
Before Cleansing After Cleansing


cunka.com

cunka.com


cunka.com

65bit.com

unsplash.com

cunka.com
65bit.com
unsplash.com

Example 3 - Adding registered trademarks ®

For for the trademark symbol ™ see Example 1 - Append trademark symbol

Look for the text myCompany and add a registered trade mark symbol using ^r.
Cleansing functions end with and are separated by a ; character.

myCompany=myCompany^r;
Before Cleansing After Cleansing

We use myCompany products.

We use myCompany® products.

Using Regular Expressions UPDATED

A more advanced method of cleansing data through pattern matching can be applied using regular expressions.

Always use the updated and more advanced REGEXV2 over the older REGEX expression when cleansing.
The ^ character is interpreted as an InDesign meta-character, so ^^ should be used for the regular expression ^ character:
Example 1 - Convert all the data in the field to be uppercase.
REGEXV2:(.)=\U\1;
  • ( ) creates a group. Connects result to \1.

  • . matches any character (except for line terminators)

  • \U uppercase transformation

  • \1 places the found group.

Field Text REGEXV2 result

cat-NZ0003E

CAT-NZ0003E

Cat-AU99e

CAT-AU99E

CAt-JP01ax

CAT-JP01AX

#1fC0d

#1FC0D

Example 2 - Convert all the data in the field to be lowercase.
REGEXV2:(.)=\L\1;
  • ( ) creates a group. Connects result to \1.

  • . matches any character (except for line terminators)

  • \L lowercase transformation

  • \1 places the found group.

Field Text REGEXV2 result

cat-NZ0003E

cat-nz0003e

Cat-AU99e

cat-au99e

CAt-JP01ax

cat-jp01ax

#1FC0d

#1fc0d

Example 3 - Convert all the data in the field to be title case.
REGEXV2:(\w)(\w*)=\U\1\L\2;
  • ( ) creates a group. Connects result to \1.

  • \w matches any word character

  • ( ) creates a group. Connects result to \2.

  • \w matches any word character

  • * matches as many times as possible

  • \U uppercase transformation

  • \1 places the found group.

  • \L lowercase transformation

  • \2 places the found group.

Field Text REGEXV2 result

indian red

Indian Red

light salmon

Light Salmon

dark golden rod

Dark Golden Rod

pale golden rod

Pale Golden Rod

Example 4 - Append "CUNKA-" where the data begins with 3 numbers.
REGEXV2:^^(\d{3})=CUNKA-\1;
  • ^^ from the start of the line

  • ( ) creates a group. Connects result to \1.

  • \d matches a digit 0-9

  • {3} matches exactly 3 times

  • \1 places the found group.

Field Text REGEXV2 result

91234

CUNKA-91234

1a345

1a345

87878

CUNKA-87878

10.00

10.00

Example 5 - From the end of the data, remove the last 3 numbers.
REGEXV2:\d{3}$=;
  • $ from the end of the line

  • \d matches a digit 0-9

  • {3} matches exactly 3 times

Field Text REGEXV2 result

91234

91

1a345

1a

87878

87

10.00

10.00

Example 6 - If the 2nd last number is an 8, change it to a "z".
REGEXV2:(8)(.)$=z\2;
  • $ from the end of the line

  • (.) creates a group. Connects result to \2.

  • (8) matches the number 8

  • \2 places the found group.

Field Text REGEXV2 result

cat-NZ0008X

cat-NZ000zX

cat-NZ00008

cat-NZ00008

cat-JPAAAAA87

cat-JPAAAAAz7

cat-AU000800

cat-AU000800

Example 7 - If the 2nd last number is an 8, append the color from the Field "myCOLOR".
REGEXV2:(8)(.)$=\1\2 (FIELDSTR(myCOLOR));
  • $ from the end of the line

  • (.) creates a group. Connects result to \2

  • (8) creates a group. Connects result to \1

  • \1 places the found group

  • \2 places the found group

  • FIELDSTR(myCOLOR) another filed called "myCOLOR" in the data source panel

FIELD "myCOLOR" Field Text REGEXV2 result

YELLOW

Cat-NZ0008X

Cat-NZ0008X (YELLOW)

GREEN

TTT-NZ00008

TTT-NZ00008

MAGENTA

CUNKA-JPAAAAA87

CUNKA-JPAAAAA87 (MAGENTA)

BLUE

65bit-AU000800

65bit-AU000800

Example 8 - Find & replace certain names

Lets look at an example where the field text is supplied to EasyCatalog with various manufacturers names. The requirement is to find/replace with your company name.

The field text could be 1 or many lines. There may also be mistakes where the manufacturers name has been entered in all lowercase or uppercase.

REGEXV2:(?i)\b(Panasonic|Samsung|Sony|LG|Akai)\b=CUNKA;
  • (?i) makes everything after it case insensitive

  • \b \b anything between is a word.

  • ( ) creates a group.

  • | acts like a boolean OR.

Field Text REGEXV2 result

Panasonic is a TV manufacturer.
Another manufacturer is akai.
sony also make TVs'.
So does Samsung.#
Do you know about LG?

CUNKA is a TV manufacturer.
Another manufacturer is CUNKA.
CUNKA also make TVs'.
So does CUNKA.
Do you know about CUNKA?

Example 9 - Change certain words to be colored text

The field text has come into EasyCatalog with no formatting applied. The objective is find certain words in the text and make them the color green.

(Assuming an InDesign Paragraph Style called GREEN exists)

In this instance we need to find certain words, and apply HTML style tags. The action will require the <GREEN> tag inserted before the found word, and the </GREEN> tag inserted after it.

REGEXV2:(?i)\b(Rain|Thunder|Lightning)\b=<GREEN>\1</GREEN>
  • (?i) makes everything after it case insensitive

  • \b \b anything between is a word.

  • ( ) creates a group. Connects result to \1.

  • | acts like a boolean OR.

  • \1 places the found group.

With ( ) in a REGEXV2 expression, it is known in regular expressions as a captured group. Each captured grouped are numbered as they are captured starting at 1.

To reuse the result of the captured group a back reference must be used. In this case the back reference \1.

Field Text REGEXV2 result

The secret word is thunder.
Lightning struck twice.
Then rain started falling.

The secret word is <GREEN>thunder</GREEN>.
<GREEN>Lightning</GREEN> struck twice.
Then <GREEN>rain</GREEN> started falling.

Example 10 - Empty text field alternative text

A field is used to provide a caption for an image. However, there is no indication that the field is empty and will need to be populated. With REGEX, we can find an empty field and place in an alternative caption.

REGEXV2:^$=MISSING CAPTION!!!;
  • ^ from the beginning of the line

  • $ to the end of the line

The REGEXV2 cleansing instruction will only add the 'MISSING CAPTION!!!' text when the field it is applied to contains no text.

Field Text REGEXV2 result

MISSING CAPTION!!!

Side Facing Diagram

Side Facing Diagram

MISSING CAPTION!!!

Say Something

Say Something

Example 11 Selectively apply a line break

Field has a unit value in brackets that has unfortunately been included on the same line. A HTML break (<br>) is needed and the white space removed.

REGEXV2:(.*[^^\s])(\s+)(\(.*\))$=\1<br>\3
  • $ from the end of the line

  • (\(.*\)) creates a group. Finds the brackets at the end. Connects result to \3

  • (\s+) creates a group. Finds the whitespace before the brackets. Connects result to \2

  • (.*[^^\s]) creates a group. Finds everything else. Connects result to \1

  • \1 places the found group

  • \3 places the found group

  • <br> inserts the required HTML break.

Field Text REGEXV2 result

Wheel Diameter (mm)

Wheel Diameter<br>(mm)

Weight       (mm)

Weight<br>(mm)

Safety (Deadman) Switch

Safety (Deadman) Switch

Input Power (W)

Input Power<br>(W)

Type(L series)

Type(L series)

Example 12 Append text to end

Text will appended to the end of everything in this field.

REGEXV2:$=-0000-CUNKA;
  • $ from the end of the line

  • append the text -0000-CUNKA

Field Text REGEXV2 result

YWQ-999

YWQ-999-0000-CUNKA

YEE-123

YEE-123-0000-CUNKA

AAA

AAA-0000-CUNKA

Example 13 Append text to end from another field

Text will appended to the end of everything in this field from another existing field.

REGEXV2:$= FIELDSTR(MYITEM);
  • $ from the end of the line

  • insert a space character after the equals sign to ensure text is not joined

  • append text from the other field called MYITEM

Field Text Field Text from MYITEM REGEXV2 result

Brown

dog

Brown dog

Green

grass

Green grass

Blue

sky

Blue sky

Example 14 Insert text from another field before the field text

Text will appended to the end of everything in this field from another existing field.

REGEXV2:^=FIELDSTR(MYITEM) ;
  • $ from the end of the line

  • insert text from the other field called MYITEM

  •  ; insert a space character before the semicolon to ensure text is not joined

Field Text Field Text from MYITEM REGEXV2 result

Pagination Module

EasyCatalog

EasyCatalog Pagination Module

Knowledgebase

CUNKA

CUNKA Knowledgebase

No Cleansing

No Cleansing

Example 15 Remove/replace all the contents of a field

There may occasions when you want to remove all the contents of a field, and possibly replace with new content.

REGEXV2:^(.*)$=;
  • ^ from the beginning of the content

  • (.*) creates a group. Gets all the content.

  • $ to the end of the content

Field Text REGEXV2 result

Purple Rasberries

CUNKA Ice Cream

Brians Chocolate Cake

REGEXV2:^(.*)$=Ice Cold Caramel Milk;
  • ^ from the beginning of the content

  • (.*) creates a group. Gets all the content.

  • $ to the end of the content

  • Ice Cold Caramel Milk replacement text

Field Text REGEXV2 result

Purple Rasberries

Ice Cold Caramel Milk

CUNKA Ice Cream

Ice Cold Caramel Milk

Brians Chocolate Cake

Ice Cold Caramel Milk

Example 16 Extract text NEW

Text you require may be embedded in a larger body of text. In this example we need the image url only from a HTML block of code.

REGEXV2:.*(https*.+(?:.jpg|.png)).*=\1;
  • .* everything before the URL

  • (https*.+(?:.jpg|.png)) creates a group. Gets the image URL by looking for https and ending with .jpg or .png.

  • .* everything after the image URL

  • \1 places the found URL only

Field Text REGEXV2 result

<div class="product" data-id="1ZSXD342EQQ">
<div class="product-image">
<a href="/1ZSXD342EQQ">
<img src="https://our-website.com/product-images/No-Image-Available.jpg" alt="Product image" />
</a>
</div>
<div class="product-info">Information about the product.</div>
</div>

https://our-website.com/product-images/No-Image-Available.jpg

Example 17 Extract text from HTML tags NEW

Remove the unwanted HTML tags and attributes from a field.

REGEXV2:(<\/?[\w\s==\\"":;\-,]+>)=;
Field Text REGEXV2 result

<h1>Laptop</h1>
<section>
<h2>15" Screen</h2>
<div data-cunka-type="laptop">CunkaView</div>
</section>

Laptop

15" Screen
CunkaView

Unicode Character Replacement

REGEXV2 itself does not support the \uFFFF unicode syntax used with many online regex testers.
The supported unicode syntax in EasyCatalog is \x{FFFF}
Example 1

This example looks at removing a range of unicode characters between 25A0 to 25C6.

REGEXV2:[\x{25A0}-\x{25C6}]=;

The InDesign Glyphs panel is a handy tool to work out the numbers of unicode characters.

Regex unicode
Example 2

Replace a unicode character with another character.
This replaces the hexadecimal code point 2028 with a soft return.

REGEXV2:[\x{2028}]=^n;

Insert Unicode Characters

Using unicode characters can be totally dependant whether the character appears in the font you are using.
Example 1 - Append trademark symbol

Text will appended to the end of everything in this field from another existing field.

REGEXV2:(\bmyTRADEMARK\b)=\1\x{2122}
  • (\bmyTRADEMARK\b) find exactly the word myTRADEMARK

  • \1 places the found word myTRADEMARK

  • \x{2122} insert the trademark character

Field Text REGEXV2 result

Trademark symbol in myTraDemarK

Trademark symbol in myTraDemarK

Trademark symbol in myTRADEMARK

Trademark symbol in myTRADEMARK™

Trademark symbol in myTrademark

Trademark symbol in myTrademark

Example 2 - Append degrees symbol

The degrees symbol ° will be appended to a number representing an angle.

REGEXV2:$=\x{00B0}
  • $ from the end of the line

  • \x{00B0} append the degree symbol

Field Text REGEXV2 result

360

360°

45

45°

90

90°

Example 3 - Append degrees celsius symbol °C

The degrees Celsius symbol °C will be appended to a number representing a temperature.

REGEXV2:$=\x{2103}
  • $ from the end of the line

  • \x{2103} append the degree celsius symbol

Field Text REGEXV2 result

200

200°C

-7

-7°C

23

23°C

Example 4 - Insert black heart suit symbol ♥

The black heart suit symbol ♥ will be inserted to the beginning of any text.

REGEXV2:^=\x{2665}
  • ^ insert at the beginning

  • \x{2665} append the black heart suit symbol

Field Text REGEXV2 result

Brian

♥Brian

CUNKA

♥CUNKA

EasyCatalog

♥EasyCatalog

Preview Cleansing Options

When designing and applying cleansing options, its possible to preview the results before applying them.

In the "General" tab of "Field Options", click on the to preview cleansing options.

Example
  • Remove $ and (includes GST) from data in the "myREGEX" field.

cleansing1
Fig 16. Cleansing Options for field "myREGEX"
cleansing2
Fig 17. Remove $ sign with " $=; " then click
cleansing3
Fig 18. Preview cleansing option results
cleansing4
Fig 19. Remove (includes GST) sign with " (includes GST)=; " then click
cleansing5
Fig 20. Preview cleansing option results

Computed Fields

What are Computed Fields?

A computed field is a special field that links to an existing data source field to perform a calculation on a document/library on the page.

The advantage of a computed field is you do not need to create a new field in your data source panel.

The disadvantage is they only work with records and do not allow the use of most of the GROUP reference commands.

Computed Fields Summary
  • They are processed and updated just like normal fields.

  • Commands can take content from any field in the record they are associated with.

  • Are linked to existing fields.

  • Can be used on image fields.

  • Applied to records and not groups.

Example Usage

You have a PRICE field for a product item in your data source panel. The PRICE field is used in a table in a library/formatting rule. The PRICE does not include a tax of 10%. Through the use of a computed field you can now modify the PRICE to include the tax without modifying the data, or adding a new field to your data.

Where Can I Find Computed Fields?

The computed fields dialog can be found in the menu Window → EasyCatalog Computed Fields.

ComputedField0
Fig 21. InDesign Window menu
ComputedField2
Fig 22. The EasyCatalog Computed Field dialog

Examples

Example 1 - Remove Dashes And Update Prices

In this example, we have a field called PART_NO1 that contains product part numbers split up with dashes. The goal will be to create a computed field in a table that removes the dashes.

ComputedField1

In addition, for each product part number, there is a price in the field PRICE_1x100 that will need to add $10 to without changing the original price. To complete this we will use another computed field.

The first thing created is a 1 row x 2 column table.

ComputedField3

The computed field needs to be linked to an existing field. For this example I’ve chosen the ID field from my data source panel. It is inserted into the first column of the table.

Make sure the cursor is in the ID field specifier on the table. If the cursor is not in the ID field specifier, the EasyCatalog Computed Field dialog box will remain greyed out.

ComputedField4

To replace the dashes, we need grab the contents of the PART_NO1 field and apply the REPLACE field command on it.

In the "fx" box of the EasyCatalog Computed Field dialog we put:

REPLACE(FIELDSTR(PART_NO1),'-','')
ComputedField5

When records are paginated in the table, you can see that the dashes in PART_NO1 are removed.

ComputedField6
$SUM(FIELDVAL(PRICE_1x100),10)
ComputedField7
ComputedField8

Final result shows all the dashes removed in the part numbers, and all prices have had $10 added to them.

ComputedField9
Example 2 - Control What Image is Shown

In this example we will override the image that will be used in the ICON1_IMAGE field for every record by determining if the ID field is greater than 50.

  • ID is 51 or greater, the icon image fa-check.png will be used.

  • ID is 50 or less, the icon image fa-truck.png will be used.

The cursor is placed in the ICON1_IMAGE on the page and the computed field "fx" below is added:

IF(FIELDVAL(ID),'>',50,'fa-check.png','fa-truck.png')
ComputedField10

As this result will be determining the image used, its important that the field been linked to (eg ICON1_IMAGE) does have a picture location path set so the computed field can find the image.

ComputedField11

The final result.

ComputedField12

Computed vs Custom Command Reference

Computed commands use many of the existing Custom commands.

As computed fields are executed on the document page, some of the panel specific commands (eg. GROUPLAST) are not available for use. However, computed fields pick up a few extra commands specific to whats on the document and where its placed. (eg.TAGPAGENUMBER)

Below we display all the commands as a quick reference.

Available Not available

Command Reference Name COMPUTED CUSTOM

AND

APPLYXSLT

AVG

BASE64DECODE

BASE64ENCODE

CALLSCRIPT

CASE

CELLSTR

CHAR

CODE128

COMPARESTR

CONCAT

CONTAINSALL

CONTAINSANY

COUNTOF

CREATERANGES

DECTOFRAC

DEPENDSON

DISTINCTLIST

DIV

DOCUMENTIMPORTPAGE

DOESFIELDEXIST

DOESIMAGEEXIST

DSSTATUS

EAN13

EAN8

ENV

EVALUATEXPATH

FIELDNAME

FIELDSTR

FIELDVAL

FILESIZE

FILLDOWNSTR

FINDFIELDCONTAINING

FOLDERDEEPSEARCH

FOLDERSEARCH

FORMATASTABLE

FORMATSTRBOOST

FRACTODEC

GETBARCODEGLYPHS

GETFIELDPLACECOUNT

GETFIELDPLACESTATE

GETNTHPOPULATEDPARAM

GETSCRATCHDOCUMENTID

GOOGLEQRCODEURL

GROUPAVG

GROUPCOLLATEPAGES

GROUPCOUNT

GROUPCOUNTUNIQUE

GROUPCREATEPAGINATIONGROUPINGS

GROUPCROSSTABLEHEAD

GROUPCROSSTABLEVALUE

GROUPFIRST

GROUPGETNTHPOPULATEDFIELDNAME

GROUPGRIDLAYOUTORDER

GROUPINDEX

GROUPISFIRST

GROUPISLAST

GROUPLAST

GROUPLIST

GROUPMAX

GROUPMIN

GROUPNUMBERSEQUENCE

GROUPONCHANGE

GROUPRTOTAL

GROUPSCRIPT

GROUPSEQUENCE

GROUPSEQUENCEONFIELDCHANGE

GROUPSERIES

GROUPSERIESONFIELDCHANGE

GROUPSNIPPETDEPTH

GROUPSUM

GROUPTABULARHEADERUNION

GROUPXREFFIELD

GROUPXREFFIELDLIST

HTMLCLEAN

HTMLCOLUMNCOUNT

HTMLENTITYDECODE

HTMLROWCOUNT

I2OF5

IF

IMAGE

IMAGEASPECT

IMAGEPATH

INDEXOF

LASTINDEXOF

LEFTSTR

LENGTH

LITERAL

LOADFILE

LOOKUP

LOWER

MAX

MIN

MOD

MUL

NOT

OR

PARTSTR

PDFCROPTO

PDFIMPORTPAGE

PDFPAGECOUNT

PDFTRANSPARENTBACKGROUND

RANDOM

RECORDTIMESTAMP

REGEX

REGEXESCAPE

REGEXV1

REMOVEBLANKLINES

REMOVEDUPLICATES

REPLACE

RESOLVEGROUPING

RIGHTSTR

ROUNDVAL

SENTENCECASE

SNIPPETDEPTH

SNIPPETWIDTH

SORT

SQL

STRIPWHITESPACE

SUB

SUBSTR

SUM

TABLESTR

TABULARVALUE

TAGFRAMEINSTANCE

TAGINSTANCE

TAGPAGENUMBER

TAGPAGEX

TAGPAGEY

TAGSPREADX

TITLECASE

TRUNCATESTR

UNIQUESTR

UPC

UPPER

URLDECODE

URLENCODE

URLSTR

WORDWRAP

XREFFIELD

XREFFIELDLIST

Document Decisions While Paginating

EasyCatalog allows you to make decisions on the document while paginating. This flexibility allows you clever dynamic control of your content on how and when things appear on a page.

You need to put instructions into the document in order to do this. The instructions appear in "[[…​…​…​]]" that are simply double square brackets that indicate where the intructions begin and end.

The instructions are created using a scripting language called LUA. Its easy to learn and you will find our uses here applicable to your projects.

Deciding on applying Column/Frame Breaks

There may occasions when a particular item appears in the document and you want to insert some form of break . Whether thats a page, column or frame break, you can control when that happens.

Example

In this example we have 2 images on the page. However, we want to have control over whether the 2nd image will have a column break applied, or a frame break. The decision is made from a field I’m using called 'ID'.

  • If the 'ID' equals 1 then its a column break.

  • Any other number in the field 'ID' its a frame break.

The LUA instruction for inserting page/column/frame is TEXT.insertbreak('…​').
eg. Inserting a column break is TEXT.insertbreak('column').

Here is the final LUA instructions we apply into the document.

[[ if(field('ID')=='1') then TEXT.insertbreak("column") else TEXT.insertbreak("frame") end;]]

This document is made up of a 2 page spread that has linked text frames that have 2 columns in them.

Here we have put the 1st image placed in the document.
After the 1st image I’ve inserted the LUA instruction code before the 2nd image. We have been careful to not leave any paragraph return markers in the document.

LUA text decisions1

This screen shot is the zoomed out view of the images and LUA code in the 2 page spread.

LUA text decisions2

When the field 'ID' equals 1 when paginating, a column break is inserted causing the 2nd image to appear in the next column.

LUA text decisions3

When the field 'ID' does not equal 1 when paginating, a page break is inserted causing the 2nd image to appear in the next column.

LUA text decisions4

Choosing Images On The Page

We can also choose whether we use one image over another depending on the field content.

Example

In this example we can choose 1 of 2 images that can be in the page depending on what the content of the field 'ID' contains.

  • If field 'ID' equals 1, use image 1.

  • Any other number in the field 'ID' use image 2.

To do this, we must insert our images into the LUA instructions.

[[ if(field('ID')=='1') then ]]
[[ else ]]
[[ end;]]
LUA text decisions5

When the field 'ID' equals 1 when paginating, the 1st image remains, and the 2nd image is removed.

LUA text decisions6

When the field 'ID' is any other number but 1, the 2nd image remains, and the 1st image is removed.

LUA text decisions7
We could have left the instructions in from the previous example and had many instructions at work.
LUA instructions are powerful tools for your use in EasyCatalog!

[[ if(field('ID')=='1') then TEXT.insertbreak("column") ]]
[[ else TEXT.insertbreak("frame") ]]
[[ end;]]

Pagination

Pagination Types

These advanced pagination options are only available with the optional EasyCatalog
Pagination module
.

EasyCatalog Pagination Types

Into Text Flows

At Page Guide Positions

At Positions Specified In The Data

Using Master Pages

Template Document

Pagination Rules

The Pagination Rules panel is only available as part of the EasyCatalog Pagination module which must be purchased separately.

EasyCatalog Pagination Rules

Using the Pagination Rules panel, it is possible to specify both :

  • Processing instructions
    Such as whether to use a Product Style during pagination

  • Layout instructions
    Such as fitting each box to the depth of the text

Actions

Actions are simple rules that are evaluated at pagination time and can be used, for example, to delete a box based on the contents of one of the fields being paginated.

Position Index

The Position Index allows you to control which record/sub-group to populate a box for a given Product Style.

PositionIndex101

Here is an example where you may want something duplicated on a page. (e.g. barcodes)

PositionIndex100

The position index can be applied to any product style boxes on the page in any order.

PositionIndex102

The Position Index can accept a few controlling attributes allowing a more defined selection of the highest value record, the lowest value record, and all records.

The attributes except field names bound by braces. eg.HIGHEST{ your field goes in here}

Attribute Description

ALL { Field Name }

The contents of the frame will be repeated once for each paragraph/line in the field’s content. So the limit is not the position number, but the amount in the field’s content.

HIGHEST { Field Name }

Can be specified to populate the box with the record containing the
highest value in the given field.

LOWEST { Field Name }

Can be specified to populate the box with the record containing the
lowest value in the given field.

Example - Basic Position Index Numbering

In this example we have set up the page with 4 product styles (image boxes). The number in the black box indicates the number used by the product index in the pagination rule.

PositionIndex8

The first 4 records are applied from our data source panel.

PositionIndex9

On this page we have changed the product index on the page so the top 2 boxes are product index 1, and the bottom 2 are product index 2.

The result is 2 records applied, and the images are duplicated.

This can be handy if you are looking to create barcode labels.

PositionIndex10

Here is the order of the boxes mixed up. Shows that you dont have to have numbers in the order of 1 to 4.

PositionIndex11
Example - Using ALL in Position Index

In this example we have a text frame that contains an image field and a text field. The position index is set to ALL in the pagination rules.

By selecting ALL, records we select and apply to the frame will be repeated until all are paginaed.

So the frame will resize as content is paginated, we have set the "Fitting" to Frame To Content.

PositionIndex1

Here 4 records have been applied and you can they have paginated from the 1 to 4 in order.

PositionIndex2
Example - Using HIGHEST{} in Position Index

The position index can be used selectively to chose a particular record. With HIGHEST, it looks for a high numerical value.

The field in my data source panel used for HIGHEST is called SEQUENCE1. eg. HIGHEST{SEQUENCE1}

PositionIndex3

When applied, the position index looks for the highest value in the SEQUENCE1 field and applies it.

PositionIndex4
Example - Using LOWEST{} in Position Index

The LOWEST attribute works in a similar way to the HIGHEST attribute, except it is looking for lowest value.

PositionIndex5
PositionIndex6
PositionIndex7

Formatting Rules

What is a function rule?

A function rule is a special type of formatting rule that uses EasyCatalog custom commands to place standard formatting rules. It contains no graphics or text to insert, but simply instructions in what formatting rule to use.

We always refer to a function rule in our documentation as a function formatting rule.

Field Option

A field has the ability to insert a Formatting Rule to be inserted between the field markers your defining through the Field Option parameter. This allows you to include quite complex logic, or layout information, inside of what looks like a regular field.

Example - Using a Function Formatting Rule

In this example we will set up formatting rules that will be used in a rule set. That rule set will have a function formatting rule that will be used to determine which rule to use. The function formatting rule will then be used in a regular field.

There will be 3 rules set up so we can place a formatting according to a color. The rule to use will be determined by the contents of the field GROUP_COLOR.

Rules

Blue
Yellow
Green

Since we wont have a rule to cover every color we will have a selection for every other color.

The screen shot below shows our 3 rules.

EasyCatalog FormattingRule Field1

First step is to create a new Function Rule.

EasyCatalog FormattingRule Field2

This will create a "New Rule".
Just note that the function rule has fx in front of it to identify what type of rule it is.

Now Edit Rule…​

EasyCatalog FormattingRule Field3

Rename the rule. In this example I’ve renamed it to "mySelectedRule".

Now in the function text box is where the decisions are made.

Decisions
Blue

Use the Blue rule

White

Use the Yellow rule

Every Other Color

Use the Green rule

To achieve this, we have used the CASE custom command on the field GROUP_COLOR.

CASE(FIELDSTR(GROUP_COLOR),BLUE,Blue,WHITE,Yellow,*,Green)
EasyCatalog FormattingRule Field4

In my panel, there is a field called "myFormattingRule". In the Field options it is set to Formatting Rule, and the Name has been set to "mySelectedRule" (Which is our function formatting rule).

EasyCatalog FormattingRule Field5

Next we must set up a New Rule Set.

EasyCatalog FormattingRule Field6

The name of my rule set is "CUNKA_rules_set_1".

EasyCatalog FormattingRule Field7

We now select our rules and drag and drop them o to the "CUNKA_rules_set_1" folder.

EasyCatalog FormattingRule Field8

On our page, we place a text frame and insert the field "myFormattingRule".

EasyCatalog FormattingRule Field9

Next with the text frame selected, the "CUNKA_rules_set_1" folder selected, we click on "Apply Rule Set To Selection".

EasyCatalog FormattingRule Field10

You can see the applied rule set by whats indicated on the bottom of the text frame.

EasyCatalog FormattingRule Field11

Selecting 3 records, I have dragged and dropped the records into the text frame and the following was paginated.

EasyCatalog FormattingRule Field12

Insert using a Tag

The enhanced HTML parser will attempt to match formatting rules to tag names.
If a tag matches, the formatting rule will be inserted into the text.

e.g. <CUNKA1>EasyCatalog is great!

If there is a formatting rule called ‘CUNKA1’, it will be inserted before the text ‘EasyCatalog is great!’.

By using a field with the enhanced HTML parser set, its now possible to conditionally choose which formatting rule will be placed into the document.

Example - Formatting Rule Selection

In this example, we have created 2 formatting rules called GOOD and NOT_GOOD. The field "formattingRuleChoice" is set up with the field options check-box settings of "Formatted" & "HTML" checked and the drop down box set to "Enhanced".

We have set the field up to look at the field "GROUP_COLOR" is set to "GREEN". If it is use the "<GOOD>" formatting rule. Otherwise use the "<NOT_GOOD>" formatting rule.

IF(FIELDSTR(GROUP_COLOR),=,'GREEN','<GOOD>','<NOT_GOOD>')
EasyCatalog FormattingRuleHTMLx2

In the document we have placed a text box and within it the field "formattingRuleChoice".

EasyCatalog FormattingRuleHTMLx1

The result of this particular record appears in the document.

EasyCatalog FormattingRuleHTMLx3

Tagging Manual Content (Tables)

Not all your tables may be generated by EasyCatalog. There will be occasions where data has come into a document, either by another source of automation, or through manual creation. With EasyCatalog, its possible to tag tables so they can be updated and tracked with EasyCatalog. This feature for tagging tables is called Cell Finder.

Cell Finder is applied to all tables in the document.
EasyCatalog v16.0.0 updated Cell Finder to match keys case insensitive.

Cell Finder

Setting Up Cell Finder

Some features in EasyCatalog must be configured before they can be used. With Cell Finder, it must be set up for operation through a defined keyboard shortcut through the InDesign Keyboard Shortcuts interface.

cellfinder1

We set Cell Finder up for use on our PCs' with the keyboard shortcut Shift+Ctrl+5.

Select Cell Finder in the Commands and in "New Shortcut:" press Shift+Ctrl+5 all at once.

Make sure the "Context:" is set to Table. If you leave it set to Default it will not work.

Click the Assign button when completed then press OK.

cellfinder2

Click on "Yes".

cellfinder3

We save the keyboard shortcut set as "CUNKA set".
Press "OK" and the shortcut key is ready to use.

cellfinder4

Basic use of Cell Finder

Example - Three tables in the document.

The 3 tables in this document have been placed in from an EXCEL spreadsheet. It is made up of 5 columns of which 3 columns are in our data source panel.

You can see from the table headers against the panel headers:

  • Catalog No. = PART_NO1

  • EAN 13 Code = EAN13_CODE

  • Colour = COLOR_NAME

cellfinder5

Pressing the Cell Finder short cut:

  • We ask the "Contents of Field:" to search the tables for columns that contain the content of PART_NO1 from our data source panel.

  • We leave the "Update" as Each row as specified by the header.

cellfinder6

When you use Each row as specified by the header the headers of the table should match the headers in the data source panel. In our instance, because we specified PART_NO1 it did find a tag the content in the Catalog No. columns in the table.

cellfinder7

Each Row As Specified By The Header

To use Each row as specified by the header efficiently we will need to do some initial work so EasyCatalog will find it easier to tag not only the PART_NO1 field, but also the EAN13CODE and COLOR_NAME fields.

To do that, we simply rename the table headers so they match that of the data source panel.

When the tags are appled, you can go back and rename the field headers to what they initially were titled.

cellfinder8

Pressing the Cell Finder short cut:

  • We ask the "Contents of Field:" to search the tables for columns that contain the content of PART_NO1 from our data source panel.

  • We leave the "Update" as Each row as specified by the header.

cellfinder9

EasyCatalog has found all 3 columns and applied tags.

cellfinder10

Adjacent Cells

Not all tables are the same. Here we have a series of "Catalogue No." fields in a row.

cellfinder11

Pressing the Cell Finder short cut:

  • We ask the "Contents of Field:" to search the tables for columns that contain the content of PART_NO1 from our data source panel.

  • We set the "Update" as Adjacent Cells.

cellfinder12

EasyCatalog has matched all fields and applied the PART_NO1 tags.

cellfinder13

Creating Tables with EasyCatalog

EasyCatalog TABLE

Types of Tables

There are many ways to create tables with EasyCatalog. So many in fact, we have a knowledgebase section dedicated to showing you how to create them.

Preprocessing Table (Using MUSTACHE)

Using the MUSTACHE templating engine to create a HTML table from JSON/hash style code.

Standard Table

Using a standard InDesign table.

FORMATASTABLE

How to use the FORMATASTABLE custom reference command to generate a table.

Using APPLYXSLT

How to use the APPLYXSLT custom reference command to generate a table from XML.

Using TABLEOF (LUA)

Using the TABLEOF command from LUA to build a table from a subset of records.

HTML formatted field

A HTML specific field for creating a table.

HTML tabular field

Using a tabular field set up to create a HTML table.

Delimited Text (CSV) tabular field

Using a tabular field set up to handle delimited text to create a table.

Data Source tabular field

Using a tabular field to generate tables from a data source panel.

Microsoft EXCEL tabular field

Using a tabular field to import EXCEL documents and generate a table.

XML tabular table

Using a tabular field set up to use XML to create a table.

XML complex table

Using XML to create a complex table.

Matrix Table

Creating and using a matrix table.

Reusing or Creating New Tables

Tables can be reused, or created new at pagination time with both requiring different methods of set up.

Go to our Creating Tables with EasyCatalog page and learn more about reusing & creating new tables

Merging Table Cells

Adjacent repeated data in table cells can be cleaned up and presented in a table through the horizontal or vertical merging of cells in EasyCatalog.

EasyCatalog Table MergeCells13

Go to our Creating Tables with EasyCatalog page and learn more about merging table cells.

Quick Selection Table

The Quick Selection Table are handy and visually appealling tables for readers to easily scan, analyze and compare.

EasyCatalog LUA selection table5
Fig 23. Using full bullet style circle
EasyCatalog LUA selection table9
Fig 24. Using hollow bullet style circle
EasyCatalog LUA selection table3
Fig 25. Using ticks
EasyCatalog LUA selection table11
Fig 26. Using full square
EasyCatalog LUA selection table7
Fig 27. Using hatching
EasyCatalog LUA selection table14
Fig 28. Using hollow diamond

Our examples show how to clean up dense tables and use unicode characters to present the reader with a better viewing experience.

Go to our Creating Tables with EasyCatalog page and learn more about Quick Selection Tables.

QR Codes

Using a Frame (Script Label)

Creating a QR code in a frame with EasyCatalog can be done using InDesigns Script Label.

The Script Label dialog can be shown by going to Window → Utilities → Script Label.

EasyCatalog QR Code1

By pasting some simple LUA code into a frames Script Label, a QR code can be created.

The only part of the LUA code you need to understand is where in your data source is the field you want to create a QR code from. The field in my panel is called WEBSITE and it has a full URL path.

Source LUA code for QR code
url = FIELD.get('WEBSITE'); (1)
frame:qrcodehyperlink(url:content()); (2)
frame:fitcontent(); (3)
1 Get the text from the field WEBSITE
2 On the frame, pass the text and create a QR code.
3 Fit the QR code into the frame.

Before pasting in the LUA code, make sure the frame is selected.

In this example I have 2 column by 1 row table. The 1st column has an image box, and the 2nd column a frame for a QR code.

EasyCatalog QR Code2

The final result shows many rows all with a different QR code from the field WEBSITE.

EasyCatalog QR Code3

Snippets

A snippet is one of the ways InDesign uses to repurpose graphics and text.

This allows you to save pieces of an existing document(s) as handy objects that can placed in other documents.

With EasyCatalog, you can use snippets as an image that can paginate when used, or simply place previously saved snippet as an image on to a document.

Snippets in EasyCatalog

Used in image fields.
Uses InDesign snippet *.idms file format.

EasyCatalog Snippets

An EasyCatalog snippet can be saved with empty fields of graphics/text with EasyCatalog fields attached. They are paginated when the snippet is placed into the image field of a document.

Example - Snippet with EasyCatalog fields

In this example we will use a snippet that has 3 EasyCatalog fields saved in it.

  • PATTERN1_IMAGE

  • FLAGS_IMAGES

  • ICON1_IMAGE

It is exported from InDesign and saved as MyImages.idms

EasyCatalog Snippets1

The snippet is in this example is saved in the Images folder of my current Workspace.

EasyCatalog Snippets2

There will be no image preview of the snippet becuase it is saved in the Workspace folder. To fix that we tell EasyCatalog in the image field "Picture Content" options to look for the file extension "idms".

EasyCatalog Snippets6

The result is we can now see the preview of the snippet been used.

EasyCatalog Snippets3

An image box (graphic) is created on the document and the field IDMS_test is applied to it.

EasyCatalog Snippets4

When a record is dragged on to the IDMS_test image box EasyCatalog now paginates for that record and populates with images.

EasyCatalog Snippets5

InDesign Snippets

Standard InDesign saved snippets can also be used.

They can be images and text/tables pre-prepared for re-use in the document.

Example - Using a standard Snippet

The following graphic frame and text frame are exported from InDesign as a snippet and saved in this example in the Workspace "Images" folder.

The file name is MySnippet.idms

EasyCatalog Snippets7

An image box (graphic) is created on the document and the field IDMS_test is applied to it.

EasyCatalog Snippets8

When a record is dragged on to the IDMS_test image box EasyCatalog places the snippet MySnippet.idms.

EasyCatalog Snippets9

Images UPDATED

Image Strategy for a URL NEW

When EasyCatalog downloads an image from a URL, by default it will build a filename based on the naming format of the URL.

There will be occasions where that will not work and you will need to look at another feature with EasyCatalog.

EasyCatalog provides a feature to specify a file naming/storage strategy.

In the Picture Options of a field , you can append a storage strategy inside of [$ brackets $] at the end of the URL.

When EasyCatalog finds [$ … $] at the end of the URL, instead of building the local storage path based on the URL content, it will use whatever is between the [$ and $].

example: http://yourwebsite-images-api/public/2/FIELDSTR(ImageP)/download[$FIELDSTR(ImageName)$]
EasyCatalog Image Strategy1
Example - Image URL with query string

Consider this example where the only way to download the image from the server is done via a query string.

https://imagestorage.cunkacloud.net/productimages/99180000-77059-front-view.png?sv=2022-02-02&ss=b&srt=sco&sp=rwdlac&se=2030-02-24T13:35:21Z&sig=AWTTrTvRIpdF1e%2Q%2Idm%2Bn6%3D

Out of the box EasyCatalog will make a mess of this. It will attempt to build a file with the query string.

By using an image strategy we can tell EasyCatalog what we are expecting the image to be named and saved as.

If we have a field with the file name in it (e.g. ImageName) we can still use the image URL string query, and retrieve and name the image as we intended it to be.

We simply append [$FIELDSTR(ImageName)$] to the end of the URL image string query.

https://imagestorage.cunkacloud.net/productimages/99180000-77059-front-view.png?sv=2022-02-02&ss=b&srt=sco&sp=rwdlac&se=2030-02-24T13:35:21Z&sig=AWTTrTvRIpdF1e%2Q%2Idm%2Bn6%3D[$FIELDSTR(ImageName)$]

Macintosh/Windows Image Paths

File paths are represented differently on Macintosh and Windows machines. 

This has an impact when working in a cross-platform environment as a picture import path configured on Macintosh would not work on Windows and vice-versa.

To overcome this, a custom field command can be used to determine the platform that EasyCatalog is running on:

IF(ENV(platform),=,Macintosh,'Macintosh HD:Images','C:\Images')

The ENV command takes a single parameter, and returns environmental information about EasyCatalog.  In this case, the ‘platform’ option has been specified and the command will return either ‘Macintosh’ or ‘Windows’. Based on the result of this we then either construct a Macintosh or Windows-type path.

Example - Brian’s Windows PC Setting

This example takes you through how the custom command works on my Windows PC.

The custom command is located in the "Location" path.

EasyCatalog Picture Path0

In the "C" drive on my computer there is an "Images" folder that contains the images.

EasyCatalog Picture Path1

The screen shot below shows the images have been discovered with the help of the ENV custom command.

EasyCatalog Picture Path2

Handling File Types

Image file type handling can be configured in the Extension parameter on the Field Options → Picture Content tab.

The "Extension" parameter
Example - Images with no file extension

Its possible that your data source panel may only have the name of the image and know nothing about the file type.

eg. Picture1

Through the "Extension" parameter, you can indicate to EasyCatalog what image file types you will handling. If they were just JPGs', you would put JPG or jpg in the "Extension" box.

If the data source indicates an image file with a file type extension, that image file will always be used.
eg.Picture1.jpg
EasyCatalog Picture Extension2
Example - Same image in multiple file formats

There may be times when you will have the same picture saved in a variety of image formats.

eg. Picture1.jpg , Picture1.png , Picture1.psd

In this example we will look at a data source panel where only the image names have been specified.

Each image is available in 3 image file formats.

  • jpg

  • png

  • psd

The first step is define the sequence we would like them to be in. So if we always want to use a JPG we put that first. If for some reason a JPG is not available we will indicate to use a PNG. If they are both not there use the PSD.

If none of them were there, we would indicate in the "Replacement Image" parameter what image to use.

The "Extension" parameter has now jpg;png;psd entered into it.

EasyCatalog Picture Extension4

Here is what my document and panel looks like. Along the top I have what the 3 file types look like. So they look different on the page, I’ve change there appearance, but they are always image Pattern1.

To the left of the data source panel you will see a graphics box we will put the image into. The panel also displays what image is currently loaded into Pattern1. In this case its the JPG image.

EasyCatalog Picture Extension3

Screen shot shows the "Pattern1.jpg" image placed on the document.

EasyCatalog Picture Extension5

The Pattern1.jpg image is now missing. So the PNG image Pattern1.png is used.

EasyCatalog Picture Extension6

Both the Pattern1.jpg and Pattern1.png images are missing. The Pattern1.psd image is now used.

EasyCatalog Picture Extension7

Workspace Folder

Within the EasyCatalog Workspace folder of your data source panel, there is an Images folder. This folder is automatically added whenever you create a data source panel.

You can either link to images in another folder, or put all your images in the Workspace Images folder. This can be very handy and it keeps all your images in one spot.

When using the Workspace Images folder, you may find you do not get a preview of the image in the data source panel. To handle this, all you have to do is add file extension(s) to the "Picture Content" Extension box. eg. JPG;PNG;IDMS

Example - JPG images in Images folder

In this example we have placed all the images (JPG) into the "CUNKA Test Panel" Workspace Images folder.

When we try to preview any of the images we get the file name only.

EasyCatalog Workspace Image0

Here are the images in the Workspace Images folder.

EasyCatalog Workspace Image1

No "Location" folder has been entered.

EasyCatalog Workspace Image2

The files are all JPGs. In the "Extension" we added JPG;

EasyCatalog Workspace Image3

Now when we hover over any of the images for this field, we will get an image preview.

EasyCatalog Workspace Image4

Multiple Images In a Field

Multiple images can be stored in a single image field in EasyCatalog.

The images are required to be separated by a carriage return in the source data.

When hovering over an image field containing multiple images, all images will be previewed. The image to use when importing this field can be selected by clicking on the preview. The selected image will have a black border.

This functionality is not supported when importing images from URLs.
Example - Using Multiple Images

In this example we have 5 images in a single image field called Images seperated by carriage returns.

rohit-tandon-67718-unsplash.jpg
pooja-chaudhary-635011-unsplash.jpg
tristan-gassert-674119-unsplash.jpg
mindy-jacobs-589308-unsplash.jpg
ferdinand-stohr-203711-unsplash.jpg
EasyCatalog Multiple Images0
EasyCatalog Multiple Images2

Hovering over the Image field we see the preview of all 5 images.

EasyCatalog Multiple Images1

To determine which image will be used, simply click on one of the previewed images. A heavy black border will then show which image has been selected.

EasyCatalog Multiple Images3

Images In Frames

The following examples look at how the Pagination Rules setting of Fitting affects the field specific Picture Content settings of Scaling & Alignment.

This table represents the original image and the 2 InDesign graphic frames it will be applied too.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1
xFramesize2

"Fitting" : None

  • Scaling : None

  • Alignment : Centre

The graphic frames and image do not change size.

Looks at the “Alignment” setting and applies an image to the frame. This may result in whitespace or cropping of the image dependent on the shape of the graphics frame.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 none none
xFramesize2 none none

"Fitting" : Frame To Content

  • Scaling : None

  • Alignment : Centre

The graphic frame changes size to that of the image.

If the “Scaling” in the Picture Content is set to “None”, the graphic frame will always resize to the image size.

However, the use of the Fill Frame “Scaling” setting will not change the frame size at all, while settings like Proportionally Fit will.

With “Scaling” set to Proportionally Fit, the frame will resize by the longest length.
e.g. If the height is longer than the width, the height will be resized.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 frametocontent none
xFramesize2 frametocontent none

"Fitting" : Content To Frame

  • Scaling : None

  • Alignment : Centre

The graphic frame never changes size.

The image is always placed according to the setting of “Scaling”.

If the “Scaling” is set to none, the original image is placed in. This may result in cropping of the image if the frame is smaller then the original image size, or whitespace around an image that is smaller then frame its applied to.

We usually like the “Scaling” setting of Proportionally Fit with Content To Frame.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 contenttoframe none
xFramesize2 contenttoframe none

"Fitting" : Frame Height To Content Height

  • Scaling : None

  • Alignment : Centre

The graphic frame height size will change, the width size however will not.

The “Fitting” setting in the Pagination Rule Frame Height To Content Height is handy when you are constrained with frame widths, but not frame depths. Situations where you have columns on a document are one example for usage.

The frame will always resize the height to the image content if the “Scaling” is set to “None”.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 frameheighttocontentheight none
xFramesize2 frameheighttocontentheight none

"Fitting" : Frame Height To Content Height And Width

  • Scaling : None

  • Alignment : Centre

The graphic frame changes size.

The image is always placed by the setting of the “Scaling”. If the “Scaling” is set to None, the original image is placed in. This may result in the image been cropped if the frame is smaller then the original image, or whitespace around an image that is smaller then frame its applied to.

A “Scaling” setting of Proportionally Fit with Frame To Content (Height & Width) is different than the Pagination Rule Frame To Content. The frame does not change size, but simply proportionally fits the image into the frame.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 frametocontentheightwidth none
xFramesize2 frametocontentheightwidth none

"Scaling" : Proportionally Fit

  • Fitting : None

  • Alignment : Centre

The graphic frame size does not change.

Depending on the frame size compared to the actual image size, the image will be resized proportionally to fit into the frame. Also dependant on what is set in the “Alignment”, there may be whitespace around the image.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 none proportionallyfit
xFramesize2 none proportionallyfit

"Scaling" : Fill Frame

  • Fitting : None

  • Alignment : Centre

The graphic frame size does not change.

The frame will always be filled to its extents with the applied image. If the image size is vastly different to the frame size, the result may be distorted. This may be however what you are seeking to do.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 none fillframe
xFramesize2 none fillframe

"Scaling" : Fill Proportionally

  • Fitting : None

  • Alignment : Centre

The graphic frame size does not change.

The frame will always be filled in proportionally to its extents with the applied image. Depending on the frame size compared to the image size, and the “Alignment” setting, not all of the image may appear in the frame.

The second image in the table has a "zoom" type effect going on as it tries to fit all of the image into the frame.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 fillproportionally
xFramesize2 none fillproportionally

"Scaling" : Fixed Scale

  • Scale : 50%

  • Fitting : None

  • Alignment : Centre

The graphic frame size does not change.

With “Scaling” set to Fixed Scale, the image is resized to the “Scale” % value first. The result is then applied to the frame depending on the “Alignment” setting. The image may or may not fit into the frame.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 none fixedscale50
xFramesize2 none fixedscale50

"Scaling" : Field Specified

  • Field 1 set to 100

  • Field 2 set to 50

  • Fitting : None

  • Alignment : Centre

The graphic frame size does not change.

With “Scaling” set to Field Specified, the image is looking for two EasyCatalog fields that contain both the height & width to apply.

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 none fieldspecified10050
xFramesize2 none fieldspecified10050

"Scaling" : Frame Specified

  • Fitting : None

  • Alignment : Centre

You can also use InDesigns own "Frame Fitting Options" that can be applied to a frame. When "Scaling" is set to Frame Specified , the settings in "Frame Fitting Options" will be used.

xFrameSize Frame Specified InDesign

Original Image

Frame 1

Frame 2

xOriginal Image
xFramesize1 none frameSpecified
xFramesize2 none frameSpecified

Workspace Folder

On installation of the EasyCatalog software, it creates an EasyCatalog Workspace folder.

By default, the EasyCatalog Workspace folder will be configured to be:

Macintosh

Documents:EasyCatalog Workspace

Windows

My Documents/EasyCatalog Workspace

The EasyCatalog Workspace folder contains a folder for each data source you create.

Within a created data source folder, EasyCatalog creates 6 default folders

  1. Assets
    Contains snippet files. (If full file paths are not supplied for the snippet file)

  2. Configurations
    Contains user created / saved configuration files. (eg. Grouping, cleansing options, custom fields…​)

  3. Data
    Contains the information files used by EasyCatalog for the data source. (eg Fields.xml)

  4. Image
    Contains image files. (If full file paths are not supplied for the image file. An image extension (eg. JPG;PNG) must be supplied for an image preview)

  5. Scripts
    Contains any user created Javascript / LUA scripts. (eg. Event Scripts, CALLSCRIPT / GROUPSCRIPT custom field references…​. )

  6. XSLT
    Contains XSL / XSLT files used for XML transformations.

FolderStructure

HTML

Tags

<font>
The <font> tag is deprecated and not supported in HTML5.
  • tag accepts color values in addition to a swatch name. Enhanced HTML parser only.

<font color="c100m0y0k0"> Testing font color attribute in the 'font' tag</font>

<font color="Cunka_Yellow"> Testing font color attribute in the 'font' tag</font>
<b> or <i>
  • support for specifying which font face should be used when applying bold and italics:
    e.g. <b boldface = “SemiBold” plainface = “Regular”>

<p>
  • accepts the “class” attribute and maps the name to an InDesign paragraph style name.

  • accepts the “shade” (highlight) attribute. This takes a swatch name, a CMYK or RGB value. Enhanced HTML parser only.

    • Example 1 : Shade color set to use the "Cunka_Yellow" swatch.

      400
      Shade1
    • Example 2 : Shade color set to use the CMYK color "100,0,0,0".

      Shade3
<small>
  • applies small caps character attribute.

<img>
  • accepts the “style” attribute to apply an InDesign object style.
    eg. <IMG src = “xxxxx” width=”2cm” height = “3cm” style = “Object Style 1”/>

  • accepts width or height attributes. If either measurement is missing the other will be calculated based on the proportions of the image.

<table>
  • the ‘width’ property, which can be in any unit-of-measure supported by InDesign, or ‘auto’ to automatically horizontally resize the table to be the width of the column it is placed in, or a percentage of the containing text box’s width.

  • the ‘class’ and ‘style’ property, which can be used to apply an InDesign table style.

<th> and <td> tags and attributes

<th>

Rows are created as InDesign table header rows.

<td>

Rows are created as InDesign body table rows.

class/style

The name of an InDesign cell style

width

Width of the table column. Keywords can also be used to specify one of EasyCatalog’s column properties: FIXED, VARIABLE, FITTOTEXT

height

The height of the table row. The height can be specified using any of InDesign’s supported measurement units.

vmerge

Specifies an EasyCatalog vertical merging attribute. Can be one of CONTENTMATCH, POPULATEDCONTENTMATCH

hmerge

Specifies an EasyCatalog horizontal merging attribute. Can be one of CONTENTMATCH, POPULATEDCONTENTMATCH

delete

Specifies an EasyCatalog row deletion property, can be one of NEVER, IFEMPTY

colspan/
rowspan

Standard HTML row and column spans.

<br>
  • tag will insert a soft return rather than a hard return.

HTML entity
  • If a HTML entity cannot be found in the current font, alternative fonts will be searched for the glyph.

  • accepts soft return entity.

HTML tabular fields
  • support the "class" attribute.

InDesign Style group support
  • levels are separated by colon.

  • As spaces aren’t allowed in tag names, EasyCatalog replaces "-" with a space before searching for a style.
    e.g. < EasyCatalog :cunka-style> will search for a style called ‘cunka style’ in the ‘EasyCatalog‘ style folder.

Tables

Cells

Apply Cell Style

Through the Apply Cell Style feature in Cell Options, an InDesign cell style can be applied from an EasyCatalog field.

The Apply Cell style feature can alternatively override the Indesign cell style use in favor of using a swatch instead. To override the cell style, the value must be prefixed with "SWATCH:"

EXAMPLE : Table row has 2 columns.

The cell in the first column is using the field "myCell" to apply an InDesign cell style.

The cell in the second column is using a field called "mySwatch" to apply a Swatch to the cell.
cellswatch1
The field mySwatch has the Prefix of SWATCH:
cellswatch2

The Apply Cell Style for the first cell is set to "myCell". The second cell is set to "mySwatch".

cellswatch4

Final result.
The first column is made of cells that have an InDesign Cell Style applied.
The second column has cells with Swatches applied.

cellswatch3
Cell Rotation

Cells can be rotated by applying the rotation tag. eg. <td rotation="90">
Enhanced HTML parser only.

EXAMPLE : The field "myHTML" has a table made up of 4 cells. Cell2 is rotated 90 degrees, Cell4 is rotated 270 degrees.

<table>
<tbody>
<tr>
<td>Cell1</td>
<td rotation="90">Cell2</td>
</tr>
<tr>
<td>Cell3</td>
<td rotation="270">Cell4</td>
</tr>
</tbody>
</table>
rotation1
The field myHTML is set up to use the Enhanced parser.
rotation2

Final result.
After manually adjusting the heights of the cells, Cell2 is rotated 90 degrees, and Cell4 is rotated 270 degrees.

rotation3

Cell Stroke Swatches NEW

Stroke Swatches can be applied using field content named in the table “Apply Cell Style” field.

Stroke Swatch commands:

  • TOPSWATCH

  • BOTTOMSWATCH

  • LEFTSWATCH

  • RIGHTSWATCH

Example 1

This example shows a 1 cell table, where each stroke will be applied a different swatch color.

The swatch colors are named AAA, DDD, JJJ, RRR.

To use the stroke swatch commands together, they are seperated by a comma.

TOPSWATCH:RRR,BOTTOMSWATCH:DDD,LEFTSWATCH:AAA,RIGHTSWATCH:JJJ
BorderSwatch2

The field Cunka_Cell_Swatch is used in the table cell "Applied Cell Style" parameter.

BorderSwatch1

The swatch stroke command with the required swatches are set up in the field Cunka_Cell_Swatch.

BorderSwatch3

Final result showing the swatches AAA, DDD, JJJ, RRR applied.

BorderSwatch4
Example 2

This example extends on from example 1. Not only will we be able to style the TOPSWATCH, BOTTOMSWATCH, LEFTSWATCH & RIGHTSWATCH borders, we will also apply a cell style.

In this example we have created a cell style called CUNKA. To apply it, we simply put it in front of the TOPSWATCH, BOTTOMSWATCH, LEFTSWATCH & RIGHTSWATCH.

CUNKA,TOPSWATCH:RRR,BOTTOMSWATCH:DDD,LEFTSWATCH:AAA,RIGHTSWATCH:JJJ
BorderSwatch5

Final result shows the cell style CUNKA applied. (Blue background)

BorderSwatch6

Indexes & SubIndexes

Using the power of EasyCatalog, you can easily generate indexes and subindexes.

Our dedicated examples detail all you need include index headers along with hyperlinking.

EasyCatalog Indexes

Basic Index

Index Hyperlinking

Subindexes

Index Headings

Custom Field Reference

Custom Field Reference listed here is from EasyCatalog version 16.2.0.20230109(26720)

AND

Description

Takes two or more arguments and performs a logical 'AND' operation testing for true or false conditions.

  • Returns TRUE if all arguments are TRUE.

  • Returns FALSE if any argument is FALSE.

Parameters

AND(argument1, argument2, . . . .)

Example

The AND formula says "If Available is equal to yes, and InStock is greater then 10, then the Status field will be true. If Available is anything else but yes, then Status will be false. If InStock is 10 or less, then Status will be false".

AND(IF (FIELDSTR(Available), '=', Yes), IF (FIELDSTR(InStock), '>', 10))
AND

APPLYXSLT

Description

Apply an XSL transformation to the contents of a field containing XML.
The XSLT file is referenced from the data sources XSLT folder located in the EasyCatalog Workspace.

Requires the XML data provider module.

Parameters

APPLYXSLT(field name, xslt file name)

Example
APPLYXSLT(XML_stuff,'chips.xsl')

The XSL file called "chips.xsl" must be located in the XSLT folder of the Data Source you will be using. Your Data Source should be located in the "EasyCatalog Workspace" folder. In this example my Data Source is called "cunka.com".

ApplyXSLT4

You can see the contents of the field "XML_stuff". This is the XML data to be transformed.

ApplyXSLT1

You can see the contents of the field "myFixed". Which has taken the file "chips.xsl" and applied a transformation to the data in the field "XML_stuff". The result is stored in the field "myFixed".

ApplyXSLT2

Here is the final result and how it appears on the page.

ApplyXSLT3

The XML source data in the example field "XML_stuff".

<?xml version="1.0" encoding="UTF-8"?>
<products>
<item>
    <sku>3890</sku>
    <brand>Cunka</brand>
    <name>BBQ Potatoe Chips</name>
    <weight>120g</weight>
</item>
<item>
    <sku>2331</sku>
    <brand>Cunka</brand>
    <name>Classic Shapes</name>
    <weight>80g</weight>
</item>
<item>
    <sku>3765</sku>
    <brand>Cunka</brand>
    <name>Spicey Chicken</name>
    <weight>87g</weight>
</item>
<item>
    <sku>4501</sku>
    <brand>Cunka</brand>
    <name>Pizza Shapes</name>
    <weight>95g</weight>
</item>
<item>
    <sku>4222</sku>
    <brand>Cunka</brand>
    <name>Sea Salt Chips</name>
    <weight>81g</weight>
</item>
</products>

The "chips.xsl" transformation source code.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <table>
      <tr>
        <td>SKU</td>
        <td>Brand</td>
        <td>Item name</td>
        <td>Weight (g)</td>
      </tr>
    <xsl:for-each select="//item">
      <tr>
        <td><xsl:value-of select="sku"/></td>
        <td><xsl:value-of select="brand"/></td>
        <td><xsl:value-of select="name"/></td>
        <td><xsl:value-of select="weight"/></td>
      </tr>
    </xsl:for-each>
  </table>
</xsl:template>
</xsl:stylesheet>

AVG

Description

Returns the average of the arguments

Parameters

AVG(argument1, argument2, . . . .)

Example
AVG(FIELDSTR(Value1),FIELDSTR(Value2),FIELDSTR(Value3))

Take the average from fields.

AVG

BASE64DECODE

Description

Decodes the specified text from Base 64

Parameters

BASE64DECODE(text to decode)

Example
BASE64DECODE(FIELDSTR(TextBase64))

Take a string encoded with Base64 and decode it.

Text to decode

TWVsYm91cm5lLCBBVVNUUkFMSUEK

Decoded Base 64 text

Melbourne, AUSTRALIA

BASE64DECODE

BASE64ENCODE

Description

Encodes the specified text as Base 64

Parameters

BASE64ENCODE(text to encode)

Example
BASE64ENCODE(FIELDSTR(Uncoded_Text))

Take a string and encode it into Base64 text.

Text to encode

Melbourne, AUSTRALIA

Encoded Base 64 text

TWVsYm91cm5lLCBBVVNUUkFMSUEK

BASE64DECODE

CALLSCRIPT

Description

You can add additional processing power to EasyCatalog by calling InDesign ExtendScript scripts from the Data Source 'Scripts' folder.

CALLSCRIPT fields are not updated until another field is updated.
CALLSCRIPT1

Scripts are passed the records field data that can be easily referenced to by myRecord["YOUR FIELD NAME GOES HERE"]. The script can refer to record data as myRecord["fieldname"]. The result returned can be a new calculated value, or a mix of existing record data.

Parameters

CALLSCRIPT(file name)

Example
CALLSCRIPT(Layouts.jsx)
CALLSCRIPT2

The 'Layouts.jsx" Javascript source code. EasyCatalog passes a record to the script always called "myRecord". You can easily get the contents of a record by knowing its field name. This example simply takes the "ID" and "ColorScheme" fields and concatenates them together in the "ID+ColorScheme" field shown in the screen shot above.

/*
   Layouts.jsx
   Put this script into the "Scripts" folder of the datasource

   by Brian Cowell
   contact@cunka.com

*/

// field names from EasyCatalog are passed to the script
// via myRecord["YOUR FIELD NAME GOES HERE"]

myRecord["ID"]+" "+myRecord["ColorScheme"];

// the result is returned to the field that called the script
Example

This example is a more advanced use of "CALLSCRIPT" where we know the color scheme that will be used, but really need the hexadecimal color value.

The color names and hexidecimal values are held in the scripts array. EasyCatalog passes the records data and the script picks out the color scheme field, then compares that name to names that exist in the array.
It then returns the hexadecimal for the color.

CALLSCRIPT

The 'Layouts.jsx" Javascript source code.

/*
   Layouts.jsx

   Put this script into the "Scripts" folder of the datasource

   by Brian Cowell  contact@cunka.com

   Color list from : https://en.wikipedia.org/wiki/List_of_colors:_A%E2%80%93F
*/

// color schemes are stored in an array. Name and hexidecimal value
var colorSchemes = [
    {colorName:"Battleship grey",hexValue:"#848482"},
    {colorName:"Bitter lime",hexValue:"#BFFF00"},
    {colorName:"Barbie pink",hexValue:"#E94196"},
    {colorName:"Bubbles",hexValue:"#E7FEFF"},
    {colorName:"Blond",hexValue:"#FAF0BE"},
    {colorName:"Black bean",hexValue:"#3D0C02"}
];

// default color will be "Black bean" if the color is not found
var hexColor=colorSchemes[5].hexValue;

// loop through all the color schemes
for (i in colorSchemes) {
    // get the color name from the field "ColorScheme" and compare it
    if (myRecord["ColorScheme"]==colorSchemes[i].colorName){
        // store the hexidecimal value if the color name is found
        hexColor=colorSchemes[i].hexValue;
        }
}

//return the hexidecimal value back to the field that called the script
hexColor;

CASE

Description

Finds the given key in a list of key/value pairs and returns the matching value. If a value can not be found, the returned value is empty.

If the last pairing of a CASE command starts with * then this is used for any non-matches. In other words, it becomes the default value.

Software/hardware programmers will identify CASE functionality as that of "switch/case" command as used in languages like Javascript, Java, C++, PHP etc.

Parameters

CASE(text,key,value . . . ., . . . .)

Example 1
CASE(FIELDSTR(Code),99,Items are on HOLD,K,Available as a KIT only,A,Accessory item,I,Indent item,C,Call for information)

This example takes existing codes from the field "Code" and uses CASE to look them up (eg. K code is "Available as a KIT only") and returns the text into the field "Code Description".

CASE
Example 2
CASE(FIELDSTR(Code),99,Items are on HOLD,K,Available as a KIT only,A,Accessory item,I,Indent item,C,Call for information,*,Not what we expected)

Same as Example 1, except it includes a default value if it can not match to anything. By using "*" as the last condition, a value can be applied to cases that do no match.

CASE2

CHAR

Description

Converts a number to the corresponding character.

  • Decimal values.

  • Hexadecimal values can be specified but must be prefixed with %.

Parameters

CHAR(numeric value of character)

Example
CHAR(FIELDSTR(HexaDecimal))

The hexadecimal value is quite easy and more intuitive for InDesign users to work with. The InDesign Glyphs panel shows the "Unicode" (hexadecimal value) which allows you to see what exact character you would like to get. Simply put the % sign in front of the unicode number and use it in CHAR().

CHAR

CODE128

Description

Converts the given string to the glyphs required to output a Code 128 barcode using the Code128bWin or Code128bWinLarge font

Requires the font Code128bWin or Code128bWinLarge.

Parameters

CODE128(text)

Example
CODE128(FIELDSTR(Text))
CODDE128

COMPARESTR

Description

Compares the string contents of a field with a value (or another field) and returns a matching result.

For more complex comparisons consider using the IF statement.

Parameters

COMPARESTR(field name, value, (optional) result if TRUE, (optional) result if FALSE)

Example 1
COMPARESTR(Availability,'Now','Now Available','Out Of Stock')
COMPARESTR
Example 2

If none of the optional COMPARESTR fields are used, the returned result will be either TRUE or FALSE.

COMPARESTR(Availability,'Now')
COMPARESTR2

CONCAT

Description

Concatenate the given parameters

Parameters

CONCAT(argument1, argument2, . . . .)

Example
CONCAT('SKU - ',FIELDSTR(CatalogueNo),' [ $',FIELDSTR(RRP),' ]')

The example takes the word 'SKU' and joins it with the contents of the fields CatalogueNo and RRP to display joined together.

CONCAT

CONTAINERINDEX NEW

Description

Returns the index of the threaded container.

Parameters

CONTAINERINDEX()

Example
CONTAINERINDEX()

CONTAINERRECORDINDEX NEW

Description

Returns the index of a record in a container.

Parameters

CONTAINERRECORDINDEX(field name)

Example
CONTAINERRECORDINDEX(CunkaTV)

CONTAINSALL

Description

Returns TRUE if the first parameter contains all of the subsequent parameters

Parameters

CONTAINSALL(string to check, string to look for, . . . .)

Example
CONTAINSALL(FIELDSTR(Available Colors),red,black)

Checks the "Available Colors" field if both "red" and "black" are listed. Returns TRUE if both are listed, returns FALSE otherwise.

CONTAINSALL

CONTAINSANY

Description

Returns TRUE if the first parameter contains any of the subsequent parameters

Parameters

CONTAINSANY(string to check, string to look for, . . . . )

Example
CONTAINSANY(FIELDSTR(Available Colors),red,black)

Checks the "Available Colors" field if either "red" or "black" are listed. Returns TRUE if any (or both) are listed, returns FALSE otherwise.

CONTAINSANY

COUNTOF

Description

Counts the number of instances of one string inside of another.

Parameters

COUNTOF(string to check, string to look for, . . . )

Example
COUNTOF(FIELDSTR(CatalogueNo),'-')

Here we are counting the amount of times the "-" appears in the CatalogNo field.

COUNTOF

CREATERANGES

Description

Parse a delimited list, creating ranges of consecutive values.

Parameters

CREATERANGES(separator,valid values (in order),single sep, range sep, values)

Example
CREATERANGES(',','S,M,L,XL,XXL,XXXL',' / ',' -- ',FIELDSTR(SIZES))

Sometimes there are many values available for an item. In this example we are talking about sizes of jeans. Now we could list all the available sizes of the jeans (field "Size"), but rather then list them all, we can also take the sizes and break them down into a range.

You can see the ranges are now listed with the "--" seperator in the "Size Ranges" field. We have also dropped the use of the "," seperator in favour of the " / " seperator for non ranges.

CREATERANGES

DECTOFRAC

Description

Converts a decimal value to a fraction

Parameters

DECTOFRAC(decimal value, (optional) add html tags to format fractional part)

Example 1
DECTOFRAC(FIELDSTR(DecimalValue))

Takes a decimal value, and converts it into a fraction value.

DECTOFRAC1
Example 2
DECTOFRAC(FIELDSTR(DecimalValue),TRUE)

This takes Example 1 a step further by using the optional parameter TRUE. The result is HTML tags (SUP & SUB) are applied to the fraction.

DECTOFRAC2

DEPENDSON

Description

Creates an explict dependency on another field being up-to-date.

EasyCatalog internally creates a dependancy tree before executing any if its commands. There are very rare occasions where it may not return the value you were expecting as it executed the commands in the wrong order. This is where DEPENDSON helps. It will explicitly create a dependancy to control the order of execution.

For example, you may have a command that takes the value of a custom field and that fields runs an external Lua script that then goes on to reference other fields.

Parameters

DEPENDSON(field name)

Example
DEPENDSON('Snippet Depth')

DISTINCTLIST

Description

Creates a list of unique values

Parameters

DISTINCTLIST(separator, string, string)

Example
DISTINCTLIST(' / ', FIELDSTR(Manufacturer),FIELDSTR(Supplier),FIELDSTR(Store))

Using three fields, we take the contents and remove duplicates and display with our designated " / " seperator.

DISTINCTLIST

DIV

Description

Divide one number by another number

Parameters

DIV(number,number, (optional) precision defaults to 7 decimal places. Use -1 to round precision only when its needed.)

Example 1
DIV(FIELDSTR(Weight grams), 1000)

This is the standard 7 decimal place output if no precision is stated.

DIV3
Example 2
DIV(FIELDSTR(Weight grams), 1000,3)

The precision of 3 decimal places.

DIV
Example 3
DIV(FIELDSTR(Weight grams), 1000,-1)

The precision value "-1" drops any trailing 0’s.

DIV2

DOCUMENTIMPORTPAGE

Description

Sets the document page to import. Can be used in the picture import location to force a specific page to import

Parameters

DOCUMENTIMPORTPAGE(page number to import, starting from 1)

Example
DOCUMENTIMPORTPAGE(2)

DOESDATASOURCEEXIST

Description

Returns TRUE if the specified data source exists

Parameters

DOESDATASOURCEEXIST(data source name)

Example
DOESDATASOURCEEXIST('CUNKA_DRILL_BITS.XLSX')

DOESFIELDEXIST

Description

Returns TRUE if the specified field exists

Its quite possible if you are visually looking at the data source panel and you can not see a field reported back as existing (TRUE), that the field will be actually hidden.

Parameters

DOESFIELDEXIST(field name)

Example 1
DOESFIELDEXIST('Stock Code')

Looking to see if the field 'Stock Code' exists. It doesn’t exist so the value shown is FALSE.

DOESFIELDEXIST
Example 2

In this example we look to see if the field HDMI_ports exists, if it does, use its contents, if it does not, then insert a dash "-".

IF(DOESFIELDEXIST('HDMI_ports'),=,TRUE,FIELDSTR(HDMI_ports),-)
DOESFIELDEXIST2

DOESFILEEXIST NEW

Description

Returns TRUE if a file at the given path exists.

Parameters

DOESFILEEXIST(file path)

Example
DOESFILEEXIST(Macintosh HD:file.txt)

DOESIMAGEEXIST

Description

Returns TRUE if an image exists as defined by the given field

Parameters

DOESIMAGEEXIST(field name)

Example
DOESIMAGEEXIST('Image')
DOESIMAGEEXIST

DSSTATUS

Description

Returns the data source status of the given field
"unchanged","updated" or "inserted"

Parameters

DSSTATUS(field name)

Example
DSSTATUS(myField)
DSSTATUS

EAN13

Description

Returns an EAN13 barcode

European Article Numbering (EAN) is used for retail product marking and identifies the product and its producer.

Requires the eanbwrp36tt font

Parameters

EAN13(text)

Example 1
EAN13(EAN13Number)
EAN13
Example 2
EAN13(FIELDSTR(Code), GETBARCODEGLYPHS('EanT48L'))

EAN8

Description

Returns an EAN8 barcode

European Article Numbering (EAN) compressed code for products with limited label space.

Requires the eanbwrp36tt font

Parameters

EAN8(text)

Example
EAN8(EAN8Number)
EAN8

ENV

Returns environment information for the given string name.

Name Value

datasourcename

The name of the current data source

version

The version number of EasyCatalog

buildno

The build number of EasyCatalog

date

The current date. Has an optional second parameter to specify the ‘nth’ day from today. eg. ENV(date,1)

username

The name of the user logged in to the machine.

osversion

The version number of the operating system

platform

The platform being used (Macintosh/Windows)

decimalpt

The character being used as the decimal separator

thousandssep

The character being used as the thousands separator

applicationname

InDesign, InCopy or InDesign Server

applicationversion

applicationversion

workspacefolder

The location of the EasyCatalog workspace folder.

Parameters

ENV(Name)

Example
ENV('username')

Using environment values can be handy to document about the document itself. This could simply be text at the beginning or the end of the document detailing who created the document, what version of Easycatalog was used, what the name of the data source was.. etc.

ENV

EVALUATEXPATH

Evaluate an XPath expression on a fields content, which should contain an XML fragment.

Requires the XML data provider module.

Parameters

EVALUATEXPATH(field name, xpath, (optional) separator)

Example
EVALUATEXPATH(XML,'/products/item/name/text()',' / ')

The field name 'XML' contains a block of XML data. The field 'XML_Evaluated_XPATH' is been asked to go and extract all the 'name' fields out of the XML data, and concatenate them using the '/' as a seperator.

EVALUATEXPATH
<?xml version="1.0" encoding="UTF-8"?>
<products>
<item>
    <sku>3890</sku>
    <brand>Cunka</brand>
    <name>BBQ Potatoe Chips</name>
    <weight>120g</weight>
</item>
<item>
    <sku>2331</sku>
    <brand>Cunka</brand>
    <name>Classic Shapes</name>
    <weight>80g</weight>
</item>
<item>
    <sku>3765</sku>
    <brand>Cunka</brand>
    <name>Spicey Chicken</name>
    <weight>87g</weight>
</item>
<item>
    <sku>4501</sku>
    <brand>Cunka</brand>
    <name>Pizza Shapes</name>
    <weight>95g</weight>
</item>
<item>
    <sku>4222</sku>
    <brand>Cunka</brand>
    <name>Sea Salt Chips</name>
    <weight>81g</weight>
</item>
</products>

FIELDNAME

Returns the name of the field using this command

Parameters

FIELDNAME()

FIELDNAME()
FIELDNAME

FIELDSTR

Returns the contents of a field

Parameters

FIELDSTR(field name)

Example
FIELDSTR(ItemName)
FIELDSTR

FIELDVAL

Returns the numerical contents of a field. This function will only return a value for numeric fields

Parameters

FIELDVAL(field name)

Example
FIELDVAL(Prices_$)
FIELDVAL

FILESIZE

Returns the size (in bytes) of the specified file. If no file is found, it returns a value of -1.

Parameters

FILESIZE(file path)

Example
FILESIZE(FIELDSTR(File_Path))

Listing file sizes in bytes from the field "File Path". If no file is found you can see the result listed as "-1" in the "Get_FILESIZE" field.

FILESIZE

FILLDOWNSTR

Takes the contents of a given field and fills down empty values

Parameters

FILLDOWNSTR(field name, sorting)

Example
FILLDOWNSTR(Size,Sort)

In this example we have only one value listed in "Size". To apply it to the rest of the items displayed, we use FILLDOWNSTR in the field "Sizes_FillDown".

FILLDOWNSTR

FINDFIELDCONTAINING

Search all fields, returns the name of the first field that matches the given regular expression.

A regular expression is a special text string for describing a search pattern.

There are a few online resource tools that can help you build regular expressions and educate how they work.

Parameters

FINDFIELDCONTAINING( regular expression )

Example
FINDFIELDCONTAINING('^Warning')

Search for the word "Warning" at the beginning of a string.

FINDFIELDCONTAINING

FOLDERDEEPSEARCH

Search a given path for a matching file, including sub folders. A number of regular expressions can be supplied. First match is returned.

Parameters

FOLDERDEEPSEARCH(folder path/empty string for the picture content location path, expression 1, expression 2, . . . .)

Example
FOLDERDEEPSEARCH('', FIELDSTR(Code).*.PNG|JPG)

This next example works under the assumption that the images follow a particular pattern, where an image name will be that of its code. So if you know the name of the code, then the image should be code.png or code.jpg.

(We could have quite easily made it PDF, EPS, AI, TXT or any other file type)

The first image below shows the field 'Images_FolderDeepSearch' is told the root location to search in is my C drive under a folder called "Cunka". I don’t need to tell it anything more even if it contains more folders, and sub folders of those folders!

FOLDERDEEPSEARCH3

This image shows the subfolders that exist under my "C:\Cunka" folder.

FOLDERDEEPSEARCH2

Here is the result, where EasyCatalog finds the folders, lists the paths and shows in this instance a preview image.

FOLDERDEEPSEARCH1

FOLDERSEARCH

Search a given path for a matching file. A number of regular expressions can be supplied. First match is returned.

Parameters

FOLDERSEARCH(folder path/empty string for the picture content location path, expression 1, expression 2, . . . .)

Example
FOLDERSEARCH('', FIELDSTR(Code).*.PNG|JPG)
FOLDERSEARCH3
FOLDERSEARCH2
FOLDERSEARCH1

FORMATASTABLE

Format a delimited value list as a HTML table

Parameters

FORMATASTABLE(input string, row delimiter, column delimiter, (optional) number of header rows, (optional) output column count, (optional) output column fill index )

Example
FORMATASTABLE(FIELDSTR(MelbourneSensors),'^n',',')

This example we are taking some comma seperated text (originally CSV) and creating a nice HTML table out of it.

You can see the contents of the field "MelbourneSensors".

FORMATASTABLE1

You can see the result in the field "table_FORMATASTABLE".

FORMATASTABLE2

Its important to set the field "table_FORMATASTABLE" to HTML.

FORMATASTABLE3

I’ve already design a nice table style with InDesign called "cunkaTable". To make sure the field "table_FORMATASTABLE" uses it, I’ve set it up in the fields "General" setting with "Prefix" & "Suffix"

FORMATASTABLE4

Here is the final result.

FORMATASTABLE5

Source comma seperated data used in the field "MelbourneSensors".

Sensor ID,Sensor Name,Sensor Description,Year Installed,Location Type,Latitude,Longitude
3,Swa295_T,Melbourne Central,2009,Outdoor,-37.81101523,144.9642949
13,Wil277_T,Flagstaff Station,2009,Outdoor,-37.81239679,144.9565265
18,Col12_T,Collins Place (North),2009,Outdoor,-37.81344861,144.9730535
25,MCEC_T,Melbourne Convention Exhibition Centre,2013,Outdoor,-37.82401776,144.9560443
58,Bou688_T,Bourke St - Spencer St (North),2018,Outdoor,-37.81686074,144.9535808
2,Bou283_T,Bourke Street Mall (South),2009,Outdoor,-37.81380667,144.9651672
20,LtB170_T,Chinatown-Lt Bourke St (South),2013,Outdoor,-37.81172913,144.9682466
10,BouHbr_T,Victoria Point,2009,Outdoor,-37.81876473,144.9471055
49,Eli501_T,QVM-Therry St (South),2017,Outdoor,-37.80730067,144.9595606
37,Lyg260_T,Lygon St (East),2015,Outdoor,-37.80310271,144.9667145
21,Rus180_T,Bourke St-Russell St (West),2013,Outdoor,-37.81244703,144.9677876
40,Spr201_T,Lonsdale St-Spring St (West),2015,Outdoor,-37.80999341,144.9722759

FORMATDATE

Reformats the given date string.
Can be used inconjuction with the environment variable 'date'. (See Example 2 and 3)

Parameters

FORMATDATE(date string, input date format, output date format)

Example 1

Take a field with a numerical date, and transform it to show the month.

FORMATDATE(FIELDSTR(DATE),'%d-%m-%Y','%B')
FORMATDATE 1

Example 2

Get todays date using the environmental variable date and transform it to show:

  • Year-Month-Day

  • ISO8671 format of day/week

  • Amount of days since January 1

FORMATDATE 2
// Field - TODAYS_DATE
ENV('date')

// Field - YEAR_Month_Day
FORMATDATE(ENV('date'),'%d/%m/%Y','%F')

// Field - ISO8671_DATE_Format
FORMATDATE(ENV('date'),'%d/%m/%Y',Day %u of week %V)

// Field - DAY of year
FORMATDATE(ENV('date'),'%d/%m/%Y',Day %j)

Example 3

Take a field with a numerical date, and transform it to show the written month, day and year.

FORMATDATE(ENV('date'),'%d/%m/%Y','%F')
FORMATDATE 3

FORMATSTRBOOST

Format a string using boost::format

Parameters

FORMATSTRBOOST(format string, pairs of (value, type[integer, string, float] ) )

Example
FORMATSTRBOOST('Latitude %.4f  //  Longatude %.4f', FIELDSTR(Latitude), float, FIELDSTR(Longatude), float)

Take some latitude & longatude field values that are rounded to 6 decimal place accuracy, concatenate them together and round to 4 decimal place accuracy.

FORMATASTRBOOST
Example
FORMATSTRBOOST('%.x', FIELDSTR(Decimal_Numbers), integer)

Pass a decimal number and convert it to hexadecimal.

FORMATASTRBOOST2

FRACTODEC

Turns a fractional value into decimal

Parameters

FRACTODEC(string, precision)

Example
FRACTODEC(FIELDSTR(FRACTION),4)
FRACTODEC

GETBARCODEGLYPHS

Returns the glyphs to use from the specified barcode font

Parameters

GETBARCODEGLYPHS(font name)

Example
GETBARCODEGLYPHS(FIELDSTR(Font_Name))
GETBARCODEGLYPHS

GETFIELDPLACECOUNT

Get the place count of a given field.
Returns the number of times the field has been placed in the front-most document (currently active document).

Parameters

GETFIELDPLACECOUNT(field name)

Example
GETFIELDPLACECOUNT(File)

This example has some PDF pages placed in the document as images. You can can see even though the images are on the document page the field "Display_GETFIELDPLACECOUNT" still has the count of 0. To update the count, right click on the field column in the data source panel and select from the menu "Update Selected Custom Field(s)". This occurs becuase the GETFIELDPLACECOUNT field is only ever tracking the front-most document. If many documents are open, it is only the currently active document (the front-most document) that GETFIELDPLACECOUNT does the count on.

GETFIELDPLACECOUNT

The count for the amount of times the "File" column images appear in the document is now shown.

GETFIELDPLACECOUNT2

GETFIELDPLACESTATE

Get the place state of a given field.
Returns the values "unplaced","unknown","ok","error".

Parameters

GETFIELDPLACESTATE(field name)

Example
GETFIELDPLACESTATE(File)

This example has some PDF pages placed in the document as images. You can can see even though the images are on the document page the field "Display_GETFIELDPLACESTATE" still has the state of unplaced. To update the state, right click on the field column in the data source panel and select from the menu "Update Selected Custom Field(s)". This occurs becuase the GETFIELDPLACESTATE field is only ever tracking the front-most document. If many documents are open, it is only the currently active document (the front-most document) that GETFIELDPLACESTATE calculates a fields state on.

GETFIELDPLACESTATE1

The state of each records field "File" now has its state shown. If its not in the document, it is "unplaced". If its in the document ist state is "OK".

GETFIELDPLACESTATE2

GETNTHPOPULATEDPARAM

Given any number of parameters, returns the n’th non-empty parameter (starting from zero)

Parameters

GETNTHPOPULATEDPARAM(field index, parameter . . . .)

Example
GETNTHPOPULATEDPARAM(0,FIELDSTR('Current_Price'),FIELDSTR('Future_Price'),FIELDSTR('Price_Flag'))

In this example we have three pricing fields. We always want to make sure an item has a price, and by default the "Price_Flag" is always set to "POA". So we want the order to be to return the "Current_Price" first. If it has no value go to the "Future_Price" field. If it has no value as well return the "Price_Flag".

GETNTHPOPULATEDPARAM

GETPARAMETERVALUE NEW

Returns the value of the given data source parameter.

Equivalent to the LUA command return DATASOURCE.get():getoption("locale");

Parameters

GETPARAMETERVALUE(param1)

Example
GETPARAMETERVALUE('param1')

GETSCRATCHDOCUMENTID

Returns the ID of a scratch document, for using with SNIPPETDEPTH and SNIPPETWIDTH commands

Parameters

GETSCRATCHDOCUMENTID(full path or filename in the data source Assets folder)

Example
GETSCRATCHDOCUMENTID(FIELDSTR(File))
GETSCRATCHDOCUMENTID

The "Assets" folder is located in the Data Source (eg. cunka.com in this case) folder you are using in your "EasyCatalog Workspace". The "Assets" folder contains the file "Cunka_Template.indd".

GETSCRATCHDOCUMENTID2

GOOGLEQRCODEURL

Generates a Google Charts URL to create a QRCode with the given content

Needs a connection to the internet.

Parameters

GOOGLEQRCODEURL(width, height, content)

Example
GOOGLEQRCODEURL(500,500,FIELDSTR(URL))
GOOGLEQRCODEURL

Populate the field with content for text representation of what the image will contain. Do this by simply grabbing, as in this example, the contents of the field 'URL'.

GOOGLEQRCODEURL4

The 'Picture Content' of the field is where the GOOGLEQRCODEURL command is put. Take careful note the default setting of "Folder" has been changed to "URL".

GOOGLEQRCODEURL2

This is the output result.

GOOGLEQRCODEURL3

GROUPAVG

Returns the average value of a given field in a group

Parameters

GROUPAVG(group path delimited by colons, field to average)

Example
GROUPAVG('Entertainment:Brand','Price')

Takes all the "Price" fields in the group "Entertainment:Brand", adds them up, then returns the result in the field "TVprice_GROUPAVG".

GROUPAVG

GROUPCOLLATEPAGES

Creates a field which can be used to group all records that fit a page

Parameters

GROUPCOLLATEPAGES(group path delimited by colons, field to sort by, page depth, page width in points, field containing record depth in points, field containing header depth in points, field containing header width in points)

Example
GROUPCOLLATEPAGES('', Lot_Number, 769, 523, RowDepth, HeaderWidth, HeaderDepth)

GROUPCOUNT

Returns the number of groups or records in a group

Parameters

GROUPCOUNT(group path delimited by colons)

Example
GROUPCOUNT('Entertainment:Brand')

Takes the group "Entertainment:Brand", and counts the amount of records, then returns the result in the field "Count_GROUPCOUNT".

GROUPCOUNT

GROUPCOUNTUNIQUE

Returns the number of unique instances of a fields content in a group

Parameters

GROUPCOUNTUNIQUE(group path delimited by colons, field to count instances of)

Example
GROUPCOUNTUNIQUE('Entertainment:Brand','Screen')

Takes the group "Entertainment:Brand", looks in the field "Screen" and counts how many unique values are in it.This example has the values "HD" and "4K" so it will display 2 in the field "Count_GROUPCOUNTUNIQUE".

GROUPCOUNTUNIQUE

GROUPCREATEPAGINATIONGROUPINGS

Used to create groupings by a specified size, usually a page size

Parameters

GROUPCREATEPAGINATIONGROUPINGS(group path delimited by colons, field to sort by, size available, field containing record size, adjust by field, sub grouping field )

Example
GROUPCREATEPAGINATIONGROUPINGS(Cat,Sort,728.549,ROWDEPTH,IMAGEROWADJUSTER,SubCat)

GROUPCROSSTABLEHEAD

Returns cross table column heading

Parameters

GROUPCROSSTABLEHEAD(group path delimited by colons, field to sort by, field to cross by, heading number (0..n))

Example
GROUPCROSSTABLEHEAD(,,GlassType,0)
GROUPCROSSTABLEHEAD1

This example starts here and extends across to the GROUPCROSSTABLEVALUE command.

Here we have data for a door company that has products with different configurations. With any particular door style, there are various glass styles that can go into the door. We start this example off by creating all the table headers - which will be coming from the glass styles.

Create Column1 header.

GROUPCROSSTABLEHEAD2
Example
GROUPCROSSTABLEHEAD(,,GlassType,1)

Create Column2 header.

GROUPCROSSTABLEHEAD3
Example
GROUPCROSSTABLEHEAD(,,GlassType,2)

Create Column3 header.

GROUPCROSSTABLEHEAD4

GROUPCROSSTABLEVALUE

Returns cross table cell content

Parameters

GROUPCROSSTABLEVALUE(group path delimited by colons, field to sort by, field to lookup, field to match, field contents to return)

Example 1
GROUPCROSSTABLEVALUE('DoorType:DoorStyle','','GlassType','Column1','StyleCode','-')

This example continues from the example given in GROUPCROSSTABLEHEAD.

Create a column for the Column1 values

GROUPCROSSTABLEVALUE1
Example 2
GROUPCROSSTABLEVALUE('DoorType:DoorStyle','','GlassType','Column2','StyleCode','-')

Create a column for the Column2 values

GROUPCROSSTABLEVALUE2
Example 3
GROUPCROSSTABLEVALUE('DoorType:DoorStyle','','GlassType','Column3','StyleCode','-')

Create a column for the Column3 values

GROUPCROSSTABLEVALUE3

Create a table to populate the data into.

GROUPCROSSTABLEVALUE4

Final result. Shows each Door Style in the grey column. Shows the Glass Styles across the top in the black row. Relevant data is populated underneath.

GROUPCROSSTABLEVALUE5

GROUPFIRST

Returns the value of a given field for the first record in a group

Parameters

GROUPFIRST(group path delimited by colons, field to sort by, field to return)

Example
GROUPFIRST('Entertainment:Brand','Price','Series')
GROUPFIRST

GROUPGETNTHPOPULATEDFIELDNAME

This command accepts a group path, an index number and a list of field names. It will look within the given groupings and return the name of n’th populated column.

This command will accept a list of field names and return the name of the n’th populated one. This function is useful for creating ‘Column 1 Name’, ‘Column 1 Value’, ‘Column 2 Name’, ‘Column 2 Value’, etc data columns.

Field name can be a regular expression.

Parameters

GROUPGETNTHPOPULATEDFIELDNAME(group path,field index (starting at 0),field 1 name, field 2 name . . . . )

Example
GROUPGETNTHPOPULATEDFIELDNAME('Entertainment:Brand',0,Name,Series,Price)

Works in a similar way to GETNTHPOPULATEDPARAM. The difference is it works on the group "Entertainment:Brand" and is looking to return field names. The sequence is "Name", "Series" and "Price". Its been told to look for populated fields in "Name" first, thus in this example they are all populated so it returns "Name" in the "Display_GROUPGETNTHPOPULATEDFIELDNAME" field. However, if one of the name fields was empty, it would return the next in the sequence which is "Series".

GROUPGETNTHPOPULATEDFIELDNAM

GROUPGRIDLAYOUTORDER

Create a numerical sequence value which enable records to be paginated on a grid.

This takes a page grid size, and fields for each records size, then assigns a sort order to each record, enabling them to be paginated using guide based pagination.

Parameters

GROUPGRIDLAYOUTORDER(group path delimited by colons, field to sort by, row count, column count, width field, height field)

Example
GROUPGRIDLAYOUTORDER('Parent Category:Child Category','',4,3,x,y)

GROUPINDEX

Creates an index based on the given field names, and returns the result with <header> and <entry> tags.

For best results set the Field Options for the field to be "Formatted", selecting both "HTML" and "Standard". Then define paragraph styles for header and entry.

Parameters

GROUPINDEX(group path delimited by colons, page number, field names to index, . . . .)

Example 1
GROUPINDEX('Entertainment:Brand',PageNumber,Brand)
GROUPINDEX
Example 2

This example shows what is captured in the field myGroupIndex.

Both header & entry paragraph styles are defined creating the final result on the page.

GROUPINDEX('GROUP_COLOR',PageNo_ColorName,COLOR_NAME)
GROUPINDEX1

GROUPISFIRST

Returns TRUE for a record in the first n positions of a group

Parameters

GROUPISFIRST(group path delimited by colons, field to sort by, (optional) number of positions - default is 1)

Example
GROUPISFIRST(Entertainment:Brand,Price)
GROUPISFIRST

GROUPISLAST

Returns TRUE for a record in the last n positions of a group

Parameters

GROUPISLAST(group path delimited by colons, field to sort by, (optional) number of positions - default is 1)

Example
GROUPISLAST(Entertainment:Brand,Price)
GROUPISLAST

GROUPLAST

Returns the value of a given field for the last record in a group

Parameters

GROUPLAST(group path delimited by colons, field to sort by, field to return)

Example
GROUPLAST(Entertainment:Brand,Price,Series)
GROUPLAST

GROUPLIST

Create a series of values in a group.
The series can be separated by optional parameters for first, regular and last occurance.
The default seperator is set to be a comma.

Parameters

GROUPLIST(The default is comma group path delimited by colons, field to sort by, field to concat, (opt.) first separator, (opt.) regular separator, (opt.) last separator, (opt.) add all, (opt.) add empty values)

Example 1
GROUPLIST(Entertainment:Brand,Price,Series,' / ' ,' / ',' / ')

Sometimes you may want a field in a group of records wrapped up so all the values can be seen in one field divided by a seperator of our choice. By using GROUPLIST we can achieve this.

This example takes the group "Entertainment:Brand", sorts it by the "Price" field. Then concatenates all the values in the "Series" field together using the " / " seperator, into the field "Display_GROUPLIST".

GROUPLIST
Example 2
GROUPLIST(Section,,Screen Size,' / ',' / ',' / ')

This example, while similar in setup to Example 1 shows how the list will be grouped if there a multiple values of a particular value.

All the Screen Size values are been grouped into a list.
If the value already exists in the list, it is not included.

This grouping is capturing a uniqee list of values - no duplicate values are included.

GROUPLIST1
Example 3
GROUPLIST(Section,,Screen Size,' / ',' / ',' / ',TRUE)

This example uses the exact same information as in Example 2.

However, the GROUPLIST includes the TRUE setting that instructs the grouping to include all values.

The example shows all the Screen Size values grouped together in the field GroupList_Screen_Sizes.

GROUPLIST2

GROUPMAX

Returns the maximum value of a given field in a group.

The given field format to be returned must be a number and not alphanumeric, otherwise the value will be 0.

Will output an empty value if ignore empty fields is on and all fields in the group are empty.

Parameters

GROUPMAX(group path delimited by colons, field to find maximum value)

Example
GROUPMAX(Entertainment:Brand,Price)

Using the group "Entertainment:Brand" , the maximum value in "Price" is found and returned into the field "Display_GROUPMAX".

GROUPMAX

GROUPMIN

Returns the minimum value of a given field in a group.

The given field format to be returned must be a number and not alphanumeric, otherwise the value will be 0.

Will output an empty value if ignore empty fields is on and all fields in the group are empty.

Parameters

GROUPMIN(group path delimited by colons, field to find minimum value)

Example
GROUPMIN(Entertainment:Brand,Price)

Using the group "Entertainment:Brand" , the minimum value in "Price" is found and returned into the field "Display_GROUPMIN".

GROUPMIN

GROUPNUMBERSEQUENCE

Given a list of page numbers, create a list of page number ranges.

Parameters

GROUPNUMBERSEQUENCE(group path delimited by colons, page number field)

Example
GROUPNUMBERSEQUENCE(Entertainment:Brand,Page_Numbers)

This example takes the group "Entertainment:Brand", then concatenates all the values in the "Page_Numbers" field together into the field "Display_GROUPNUMBERSEQUENCE".

GROUPNUMBERSEQUENCE

GROUPONCHANGE

Returns TRUE everytime a field changes, FALSE otherwise

Parameters

GROUPONCHANGE(group path delimited by colons, field to sort by, field to check for changes)

Example
GROUPONCHANGE(Entertainment:Brand,Price,Brand)

Takes the group "Entertainment:Brand", sorts by the "Price" field, then looks at when the field "Brand" changes. The result TRUE (when the "Brand" changes) or FALSE is then returned into the field "Display_GROUPONCHANGE".

GROUPONCHANGE

GROUPRTOTAL

Returns the running total of a given field in a group

Parameters

GROUPRTOTAL(group path delimited by colons, field to sort by, field to total)

Example
GROUPRTOTAL(Entertainment:Brand,Price,Price)

Using the group "Entertainment:Brand" , the field "Price" is used to sort the order, then each record for "Price" calculates a running total of the "Price" field and is returned into the field "Display_GROUPRTOTAL".

GROUPRTOTAL

GROUPSCRIPT

Call a LUA based script. A 'recordset' object is passed with the group contents. The returned result is a table. (For use in a Tabular field)

Parameters

GROUPSCRIPT(group path delimited by colons, field to sort by, script name)

Example
GROUPSCRIPT('Group1','Price','Brians.lua')

The field format of "Display_GROUPSCRIPT" must firstly be set to "Tabular". The "Source:" must be then be set to "Command Script".

GROUPSCRIPT1

Put the command into the "Custom Field" contents.

GROUPSCRIPT2

The result shows the table returned by the "Brians.lua" script.

GROUPSCRIPT3
--[[

    Brians.lua
    Put this script into the "Scripts" folder of the datasource

    by Brian Cowell  contact@cunka.com

]]

-- create a new table
mytable = TABLE.new();

-- EasyCatalog passes a recordset to LUA
-- Starting at the first record loop through each one
for i=1,recordset:size() do
  -- get the current record
  myRecord = recordset:getrecord(i)
  -- get the fields Group2, Name, Price, Size & Status from the record
  group2=myRecord:field('Group2')
  name=myRecord:field('Name')
  price=myRecord:field('Price')
  size=myRecord:field('Size')
  status=myRecord:field('Status')
  -- add the  rows and columns to the table
  mytable:cell(i,1):setcontent(group2:content())
  mytable:cell(i,2):setcontent(name:content()..' '..size:content())
  mytable:cell(i,3):setcontent('$'..price:content()..' ('..status:content()..') ')
end

-- return the table
mytable:present();

GROUPSEQUENCE

Returns one value from a sequence depending on where the record appears in a group

Parameters

GROUPSEQUENCE(group path delimited by colons, field to sort by, colon delimited sequence list, (optional) field name - TRUE to include record in sequence)

Example
GROUPSEQUENCE('Entertainment:Brand','Price','A:B:C:D')

Using the group "Entertainment:Brand" and sorting by the "Price" field, take the sequence of "A:B:C:D" and sequentially apply it to the records and return the result in the "Display_GROUPSEQUENCE" field.

While this example simply used "A:B:C:D", it could have easily been colors,InDesign master page names, numerical numbers etc.

GROUPSEQUENCE

GROUPSEQUENCEONFIELDCHANGE

Returns one value from a sequence depending on where the record appears in a group

Parameters

GROUPSEQUENCEONFIELDCHANGE(group path delimited by colons, field to sort by, colon delimited sequence list, field name - reset sequence when this field has content)

Example
GROUPSEQUENCEONFIELDCHANGE('Entertainment','Price','black:white:red','Series')

Using the group "Entertainment:Brand" and sorting by the "Price" field, take the sequence of "black:white:red", sequentially apply it to the records when the field "Series" changes. Then return the result in the "Display_GROUPSEQUENCEONFIELDCHANGE" field.

Now the trick to GROUPSEQUENCEONFIELDCHANGE is not what content is in the field "Series", but whether content exists or does not exist.

The sequence starts off with "Black" and always uses "Black" if the field "Series" has content. The first empty field in "Series" becomes "White" and the next empty becomes "Red". However, if there is content in "Series", it refers back to "Black".

GROUPSEQUENCEONFIELDCHANGE

GROUPSERIES

Populate a group with a numerical series

The direction of sorting (ascending/descending) can be set in the custom field group path and sort parameters.
Prefix each field name with ‘<’ for a descending sort; ‘>’ for an ascending sort. If unspecified, the default is an ascending sort

Parameters

GROUPSERIES(group path delimited by colons, field to sort by, starting integer, increment, (optional) increment every nth record count)

Example
GROUPSERIES(Entertainment:Brand,Price,10,10)

Using the group "Entertainment:Brand" , populate the "Display_GROUPSERIES" field from the groups first record with incrementing numbers, starting at 10 and incrementing by amounts of 10.

Counting restarts at a new group.

GROUPSERIES

GROUPSERIESONFIELDCHANGE

Populate a group with a numerical series that increments each time a given field changes value

Parameters

GROUPSERIESONFIELDCHANGE(group path delimited by colons, field to sort by, field to monitor for changes, starting integer, increment, (optional) true/FALSE - include blank fields, (optional) increment every nth change )

Example
GROUPSERIESONFIELDCHANGE(Entertainment:Brand,Price,Series,10,10,true)

Using the group "Entertainment:Brand" and sorting by the field "Price", look for changes in the field name "Series". The changes we are looking for are not the content itself, its if there is or is not any content at all. If the field "Series" does have content, then the first occurence will start off with the number 10, and increment by the count of 10 for every subsequent occurence.

Counting restarts at a new group.

GROUPSERIESONFIELDCHANGE

GROUPSNIPPETDEPTH

Returns the depth of a snippet when rendered with records in a group

Parameters

GROUPSNIPPETDEPTH(group path delimited by colons, field to sort by, snippet path)

Example
GROUPSNIPPETDEPTH(Group1:Group2,Sort,FIELDSTR(mySnippet))
GROUPSNIPPETDEPTH

GROUPSNIPPETDIMENSIONS

Returns the width and height in when rendered with records in a group

Parameters

GROUPSNIPPETDIMENSIONS(group path delimited by colons, field to sort by, snippet path)

Example
GROUPSNIPPETDIMENSIONS('Group1:Group2','mySort','C:\\Cunka\Asia\Client3\glasspaneltypes.idms')

GROUPSNIPPETWIDTH

Returns the width of a snippet when rendered with records in a group

Parameters

GROUPSNIPPETWIDTH(group path delimited by colons, field to sort by, snippet path)

Example
GROUPSNIPPETWIDTH('Group1:Group2','mySort','C:\\Cunka\Asia\Client3\glasspaneltypes.idms')

GROUPSUM

Returns the total of a given field in a group

Parameters

GROUPSUM(group path delimited by colons, field to add up )

Example
GROUPSUM(Entertainment:Brand,Price)

Using the group "Entertainment:Brand" , get all the values in the "Price" fields and calculate there sum total. The result is returned into the field "Display_GROUPSUM".

GROUPSUM

GROUPTABULARHEADERUNION

Takes tables from a group of records and creates tables with a common set of headers

Parameters

GROUPTABULARHEADERUNION(group path, tabular field name )

Example
GROUPTABULARHEADERUNION(Section:Category,AttributeList)

GROUPXREFFIELD

Returns the value of a field from another record in a group

Parameters

GROUPXREFFIELD(group path delimited by colons, field to sort by, field to search for, field content to search for, field contents to return )

Example
GROUPXREFFIELD('Parent Category:Child Category',''PartNo',FIELDSTR('XRefPartNo'),'Page')

GROUPXREFFIELDLIST

Behaves like XREFFIELDLIST, but this function limits searches to the specified group.

Parameters

GROUPXREFFIELDLIST(group path, sort field, field to search, field content to search for, field contents to return, (optional) first separator, (optional) middle separator, (optional) end separator)

Example 1
GROUPXREFFIELDLIST('Parent:Child','Price','PartNo',FIELDSTR('XRefPartNo'),'Page')
Example 2

The field called colorNames_XXXL is being specifically used to find all the SIZES of XXXL within the group. (GROUP_COLOR).

GROUPXREFFIELDLIST(GROUP_COLOR,,SIZES,XXXL,COLOR_NAME,' / ',' / ',' / ')
GROUPXREFFIELDLIST1

HTMLCLEAN

Cleanup raw HTML using a basic HTML5 parsing algorithm.
It tries to balance start/end tags and adds missing tags.

Parameters

HTMLCLEAN(html)

Example 1
HTMLCLEAN(FIELDSTR(DataTable))
Example 2

This example has a field called HTMLClean that contains HTML code with missing tags </td>.

<table>
<tbody>
<tr>
<td>Row 1 Cell 1
<td>Row 1 Cell 2
</tr>
<tr>
<td>Row 2 Cell 1</td>
<td>Row 2 Cell 2</td>
</tr>
</tbody>
</table>
HTMLCLEAN1
HTMLCLEAN(FIELDSTR(HTMLclean))

The result is the tags are fixed.

HTMLCLEAN2

HTMLCOLUMNCOUNT

Returns the maximum number of columns in a HTML table.
Returns 0 if one doesn’t exist

Parameters

HTMLCOLUMNCOUNT(html string)

Example 1
HTMLCOLUMNCOUNT(FIELDSTR(HTMLtable))
HTMLCOLUMNCOUNT

Source HTML table used in the field "HTMLtable".

<table>
    <tbody>
    <tr>
        <td>Item Code</td>
        <td>Name</td>
        <td>Weight</td>
        <td>Stock</td>
    </tr>
    <tr>
        <td>CNK-BBQ</td>
        <td>Cunka BBQ Shapes</td>
        <td>100g</td>
        <td>Available</td>
    </tr>
    <tr>
        <td>CNK-SAV</td>
        <td>Cunka Salt &amp; Vinegar</td>
        <td>95g</td>
        <td>Available</td>
    </tr>
    <tr>
        <td>CNK-PZZ</td>
        <td>Cunka Pizza Shapes</td>
        <td>107g</td>
        <td>On Order</td>
    </tr>
    <tr>
        <td>CNK-BAC</td>
        <td>Cunka Bacon &amp; Cheese</td>
        <td>110g</td>
        <td>Available</td>
        </tr>
    </tbody>
</table>

HTMLENTITYDECODE

Decode a string with HTML entities.

HTML entities are

Character Entity Value Description

&nbsp;

Inserts A Non-Breaking Blank Space

&

&amp;

Ampersand

&para;

Paragraph Symbol

§

&sect;

Section Symbol

"

&quot;

Quotation Mark

©

&copy;

Copyright Symbol

®

&reg;

Registered Symbol

&trade;

Trademark Symbol

&ldquo;

Opening Double Quotes

&rdquo;

Closing Double Quotes

&lsquo;

Opening Single Quote Mark

&rsquo;

Closing Single Quote Mark

&bull;

Big List Dot

·

&middot;

Medium List Dot

&hellip;

Horizontal Ellipsis

|

&#124;

Vertical Bar

¦

&brvbar;

Broken Vertical Bar

&ndash;

En-Dash

Em-Dash

«

&laquo;

Angle Quotation Mark (Left)

»

&raquo;

Angle Quotation Mark (Right)

&lsaquo;

Single Left Angle Quotation

&rsaquo;

Single Right Angle Quotation

Parameters

HTMLENTITYDECODE(string)

Example
HTMLENTITYDECODE(FIELDSTR(HTMLEntity))
HTMLENTITYDECODE

HTMLROWCOUNT

Returns the maximum number of rows in a HTML table.
Returns 0 if one doesn’t exist.

Parameters

HTMLROWCOUNT(html string)

Example
HTMLROWCOUNT(FIELDSTR(HTMLtable))

This example uses the same HTML code used in the HTMLCOLUMNCOUNT example.

HTMLROWCOUNT

I2OF5

Encodes the given numerical value into barcode font glyphs in the Interleaved 2 of 5 format.

Parameters

I2OF5(string)

Example
I2OF5('1234567890')

IF

Unlike the COMPARESTR command (that only compares strings), the ' IF ' command also allows an operator to be specified to make more complex comparisons on strings, numerials and booleans.

Can evaluate a condition, returning TRUE/FALSE or optional values.

For simple string comparisons only, another option is to use COMPARESTR command in place of the IF* statement.

Using COMPARESTR statement

COMPARESTR(COLOR_NAME,'red','Found Red Color','No Red Color Found')

Using IF statement

IF(FIELDSTR(COLOR_NAME),=,'red','Found Red Color','No Red Color Found')

Operand

Symbol Description

<

Less than

>

Greater than

=

Equal to

<=

Less than or equal to

>=

Greater than or equal to

<>

Not equal to

Parameters

IF(string, operand, value, (optional) value if TRUE, (optional) value if FALSE)

Example
IF(FIELDSTR(Price), '>', 2500, 'YES ! The price is greater than 2500', 'No. The price is less than 2500')
IF1
Example
IF(FIELDSTR(Price), '>', 2500)

Shows TRUE or FALSE

IF2

IMAGEASPECT

Determines the aspect of an image field (Width / Height)

Parameters

IMAGEASPECT(field name)

Example
IMAGEASPECT(Image)
IMAGEASPECT

IMAGEPATH

Returns the full path of the image for the given field

Parameters

IMAGEPATH(field name)

Example
IMAGEPATH(Image)
IMAGEPATH

IMPORTFILE

Extracts the text content from a given file.

Parameters

IMPORTFILE(file)

Example
IMPORTFILE('Users/cunka/desktop/word.docx')

INDEXOF

Find the character index of one string within another, starting at the specified text index.

Returns -1 if nothing is found.

Parameters

INDEXOF(string to search within, string to search for, index to start from (default 0))

Example 1
INDEXOF(FIELDSTR(Series),'-')

Find the index of "-" (the amount of characters in the string) and return the numerical result.

INDEXOF
Example 2
INDEXOF(FIELDSTR(Name),'sonic')

Find the index of "sonic" (the amount of characters in the string) and return the numerical result. If it does not find an index, it returns the value of -1.

INDEXOF2

LASTINDEXOF

Find the character index of one string within another - working backwards through the string - starting at the specified text index.

Parameters

LASTINDEXOF(string to search within, string to search for, index to start from (defaults to the end of the string) )

Example
LASTINDEXOF(FIELDSTR(Name),'a')

Sometimes there may be more then one occurence, this finds the last occurence. In this example we are finding the letter "a" in "Panasonic" and "Samsung".

Keep in mind counting of characters starts at 0.

LASTINDEXOF

LEFTSTR

Returns the left part of a field

Parameters

LEFTSTR(field name, number of characters)

Example
LEFTSTR(FIELDSTR(Brand),4)
LEFTSTR

LENGTH

Returns the number of characters in the given field.

Parameters

LENGTH(the string to return the length of)

Example
LENGTH(FIELDSTR(Brand))
LENGTH

LITERAL

This function is useful for passing a string literal to a command that expects a field name.
Returns the contents of the given parameter.

Parameters

LITERAL(string)

Example 1
LITERAL('abcdefg')
Example 2

In this example we would like to pass a string directly into the custom command LEFTSTR and get the first 5 letters in the field my_Literal.

The problem is, the first parameter expected with LEFTSTR is that of a field name.

By using LITERAL we can override the expectations of LEFTSTR and simply pass it a string value.

In this instance we have put into LITERAL the string CUNKA Pagination Experts and LEFTSTR returns the value of CUNKA.

LEFTSTR(LITERAL(CUNKA Pagination Experts),5)
LITERAL

LOADFILE

Load a Unicode encoded file

Parameters

LOADFILE(file path)

Example 1
LOADFILE(FIELDSTR(TextFiles))

This loads in a simple text file containing no Unicode encoding.

LOADFILE
Example 2
LOADFILE(FIELDSTR(TextFiles))

This loads in a text file containing Unicode encoding.

LOADFILE2

LOOKUP

Searches a field in each record and then returns a value for another field (Can be more than 1 field). Handles multiple matches.

The value returned is a HTML formatted table.

By default, if a data source name is not included, the LOOKUP will be applied to its own data source panel.

Parameters

LOOKUP(search string, search field, return field(s), data source name)

Example 1
LOOKUP(FIELDSTR(ID), ID, 'Description,Price', accessories.xls)
Example 2

In this example the field ID is been looked up and the fields PART_NO1 , FOOD & PRICE_1x100 are been returned in the format of a HTML table. There is no data source included so the LOOKUP will use the data source LOOKUP is set up in.

LOOKUP(FIELDSTR(ID), ID, 'PART_NO1,FOOD,PRICE_1x100')

The field myLOOKUP has been set to expect HTML formatted data.

LOOKUP3

The myLOOKUP field has been placed into a text frame.

LOOKUP1

The result as it looks on the page.

LOOKUP2

LOWER

Returns the contents of a field in lower case

Parameters

LOWER(field name)

Example
LOWER(Series)
LOWER

MAX

Returns the maximum value found from a list values

Parameters

MAX(value1, value2, . . . .)

Example
MAX(FIELDSTR(Price1),FIELDSTR(Price2),FIELDSTR(Price3))

Takes the values in the fields "Price1", "Price2", "Price3" and returns the maximum value in the field "Display_MAX".

Will also accept a comma seperated list if only 1 argument is supplied.

MAX

MIN

Returns the minimum value found from a list values

Parameters

MIN(value1, value2, . . . .)

Example
MIN(FIELDSTR(Price1),FIELDSTR(Price2),FIELDSTR(Price3))

Takes the values in the fields "Price1", "Price2", "Price3" and returns the minimum value in the field "Display_MIN".

Will also accept a comma seperated list if only 1 argument is supplied.

MIN

MOD

Returns the remainder after a number is divided by a divisor

Parameters

MOD(number, divisor)

Example
MOD(FIELDSTR(Amount),FIELDSTR(DividedBy))
MOD

MUL

Multiply one number by another

Parameters

MUL(number, number)

Example
MUL(FIELDSTR(Amount),FIELDSTR(MultipliedBy))
MUL

NOT

Description

Performs a logical 'NOT' operation on the given boolean argument.

  • TRUE will return FALSE.

  • FALSE will return TRUE.

Parameters

NOT(argument)

Example

The NOT command takes an existing TRUE/FALSE value and returns its opposite value. So if a value is TRUE, using NOT will return FALSE.

NOT(FIELDSTR(Status))
NOT

OR

Description

Takes two or more arguments and performs a logical 'OR' operation testing for true or false conditions.

  • Returns TRUE if any argument is TRUE.

  • Returns FALSE if all arguments are FALSE.

Parameters

OR(argument1, argument2, . . . .)

Example

With OR, we only need one of the two arguments to be true, and the result will be true.

OR(IF (FIELDSTR(Available), '=', Yes), IF (FIELDSTR(InStock), '>', 10))
OR

PARTSTR

Information can be combined into a field string and separated by a delimiter. PARTSTR uses the delimiter and an index to determine where in the string to take the the returned result.

An optional count introduced recently allows more then 1 result to be returned.

Parameters

PARTSTR(field, index (starting at 0), delimiter, count (optional))

Example 1

Simple examples using various delimiters to get a particular value from the string and put it into the Display_PARTSTR field.

Just remember the index value starts counting from 0 and not 1.

PARTSTR(DelimitedText,FIELDSTR(Index),FIELDSTR(DelimiterUsed))
PARTSTR
Example 2

Using the optional count value to return more than 1 result in the CUNKA_PARTSTR_DEMO field.

PARTSTR(FIELDSTR(DELIMITED TEXT),FIELDSTR(INDEX),FIELDSTR(DELIMITER),FIELDSTR(COUNT))
PARTSTR1

PDFCROPTO

Sets the PDF crop option. Can be used in the picture import location.

Cropping values can be contentvisibleonly, art, page, trim, bleed, media, contentalllayers.

Parameters

PDFCROPTO(cropping value)

Example
PDFCROPTO(bleed)C:\EC_Commands

This example uses a PDF that has a bleed setting on it.
The field name "File" contains the CUNKA2.PDF.

PDFCROPTO

The field name "File" is set up for the scaling to fill the frame from the top left and has the command PDFCROPTO(bleed)C:\EC_Commands placed in the picture import location.

PDFCROPTO2

This is the PDF placed on the page with its bleed still in place.
The bleed is the blue frame around the placed PDF.

PDFCROPTO3

PDFIMPORTPAGE

Sets the PDF page to import.
Can be used in the picture import location to force a specific page to import.

One thing that should be observed using PDFIMPORTPAGE is that the data source panel does not preview the page it is importing. The preview shown is a low res image of page 1 from the PDF.
Parameters

PDFIMPORTPAGE(page number to import, starting from 1 )

Example
PDFIMPORTPAGE(FIELDVAL(Page))C:\EC_Commands

This examples uses CUNKA.PDF. Here are the 4 pages in the PDF.

PDFIMPORTPAGE1

The preview in the data source panel shows a low res picture of page 1.
The example will be importing page 2 of the CUNK.PDF into the document.

PDFIMPORTPAGE2

The PDFIMPORTPAGE command is in the "picture location" along with the file path (Windows7) to the location of the PDF. Take note that each page has its own "Page" field (using FIELDVAL()) that instructs what page to import.

PDFIMPORTPAGE3

Page 2 is imported and placed on the page.

PDFIMPORTPAGE4

PDFPAGECOUNT

Returns the number of pages in the given PDF.
Will return a value of 0 if the PDF cannot be opened or parsed.

Parameters

PDFPAGECOUNT(filepath to PDF)

Example 1

The file path to the CUNKA.PDF is directly entered into the command PDFPAGECOUNT.

PDFPAGECOUNT('C:\EC_Commands\CUNKA.PDF')
Example 2

In this example I have the EasyCatalog PDF Manual in my downloads folder on my PC. The file path to it is stored in the field PDF_PATH.

PDFPAGECOUNT(FIELDSTR(PDF_PATH))
PDFCOUNT

PDFTRANSPARENTBACKGROUND

Sets whether the PDF transparent background is switched on or off.

  • on = TRUE

  • off = FALSE

Can be applied in the picture import location.

Parameters

PDFTRANSPARENTBACKGROUND( TRUE or FALSE )

Example 1
PDFTRANSPARENTBACKGROUND(TRUE)
Example 2

The field PDF_TRANSPARENT has been set to TRUE.
The field PDF_NON_TRANSPARENT has been set to FALSE

PDFTRANSPARENTBACKGROUND(FALSE)
PDFTransparent1

The command is applied in the picture import location. In this case the screenshot is showing what is applied to the field PDF_NON_TRANSPARENT.

PDFTransparent2

The end result shows the transparent picture on the left, and the non-transparent (has a white background) on the right.

PDFTransparent3

QRCODEENCODEEMAIL NEW

Returns a string the can be used to generate an email QR Code.

To be used inconjunction with the Field 'Barcode' parameter.

Parameters

QRCODEENCODEEMAIL(email address, email subject, email message)

Example
QRCODEENCODEEMAIL(FIELDSTR(EMAIL),FIELDSTR(EMAIL_SUBJECT),"Please contact us Brian when time permits.")
QRCODEENCODEEMAIL 1
QRCODEENCODEEMAIL 2

QRCODEENCODESMS NEW

Returns a string the can be used to generate an SMS QR Code.

To be used inconjunction with the Field 'Barcode' parameter.

Parameters

QRCODEENCODESMS(phone number,sms message)

Example
QRCODEENCODESMS(FIELDSTR(PHONE_NUMBER),FIELDSTR(SMSTEXT))
QRCODEENCODEEMAIL 1
QRCODEENCODEEMAIL 2

QRCODEENCODEVCARD NEW

Returns a string the can be used to generate a VCard QR code.

To be used inconjunction with the Field 'Barcode' parameter.

Parameters

QRCODEENCODEVCARD(first name, last name, address, city, state, zipcode, country, telephone, cell phone, email, website, job title, organization)

Example
QRCODEENCODEVCARD(FIELDSTR(FIRST_NAME), FIELDSTR(LAST_NAME), FIELDSTR(CITY), FIELDSTR(COUNTRY),FIELDSTR(EMAIL))
QRCODEENCODEVCARD 1
QRCODEENCODEVCARD 2

RANDOM

Creates a random number integer in the specified range

Parameters

RANDOM(minimum value, maximum value)

Example
RANDOM(FIELDVAL(Minimum), FIELDVAL(Maximum))
RANDOM

RECORDTIMESTAMP

Returns a records timestamp in seconds in a Unix/POSIX time format.

An example timestamp returned for January 10th, 2020 would be 1578629819.

The RECORDTIMESTAMP uses the Unix time stamp to measure time in seconds from January 1st, 1970 at UTC till the creation of the record.

Because handling and manipulating dates can be ackward due to the many configurations you can use, the RECORDTIMESTAMP allows the date to appear as a number, which can be more easily compared with against other records.

Parameters

RECORDTIMESTAMP()

Example
RECORDTIMESTAMP()
RECORDTIMESTAMP

REGEX

Search and replace the given string using a regular expression.

A regular expression is a special text string for describing a search pattern.

There are a few online resource tools that can help you build regular expressions and educate how they work.

Parameters

REGEX(the string to search, a regular expression, the replacement string)

Example 1 - Remove non-numerical characters
REGEX(FIELDSTR(Text), '[a-zA-Z]','')

Removes any characters from "a-z" and "A-Z". Not specifying a replacement string removes characters.

REGEX1
Example 2 - Remove non-numerical characters and whitespace
REGEX(FIELDSTR(Text), '([a-zA-Z]+,|\s)','')

This REGEX examples also removes characters. However, it is been very specific with what it chooses. It is looking for any whitespace as well as characters from "a-z" and "A-Z"..

REGEX2
Example 3 - Replace text at the start of a product code
REGEX(FIELDSTR(Product Code), '^(\d{3}-)',FIELDSTR(Prefix)-)

In this REGEX example we are looking at replacing the first values of Product Code with a new designated Prefix (eg CAT). The conditions for this REGEX is it must only replace a Product Code that begins with 3 numbers,and must leave the other Product Codes as they are.

REGEX3
Example 4 - Extract a number sequence from within a filename
REGEX(FIELDSTR(OTHER_IMAGES), '^(\D{1,})(\d{5,})(\D{1,})','\2')

In this REGEX example we are looking to extract the number (5 or more digits in length) from a filename in the field OTHER_IMAGES and put the result in the field x_REGEX_Unsplash.

The conditions are it looks for any non-digit characters (as 1 group) until it finds at least 5 digits (group 2). It then returns group 2 as \2.

REGEX4
Example 5 - Capture the last word of a sentence
REGEX(FIELDSTR(LOREM_SENT1), '(.+)(\b\w+).$','\2')

This example using REGEX, explores capturing the last word of a sentence from another field..

The field LOREM_SENT1 contains the sentence..
The field myREGEX is used to store the last word.

REGEX5

REGEXESCAPE

Escapes the regular expression reserved characters in the provided string content.

Here is the list of reserved characters use by REGEXESCAPE.

Regular Expression Reserved Characters

[

\

^

$

.

|

?

*

+

(

)

{

}

Regular expressions contains reserved characters required to perform pattern matching. If you use say the + character as part of pattern matching a regular expression, it must be escaped through the use of the \ character, otherwise it may not be found.

1+1
1\+1

Using the custom reference REGEXESCAPE there is no need to provide the \.

Parameters

REGEXESCAPE(string)

Example
REGEXESCAPE(FIELDSTR(myField))

REGEXV1

Search and replace the given string using a regular expression.
This uses an older regular expression parser and is more limited then REGEX.
This parser will run faster then REGEX if the expression can be run.

Recommend using the REGEX command as it has more functionality.

Parameters

REGEXV1(the string to search, a regular expression, the replacement string)

Example 1
REGEXV1(FIELDSTR(SERIAL_NO), '^(....)-(....)-(....)','XXX')

This example is looking for a pattern seperated by dashes in the field SERIAL_NO, then removing that pattern and saves the result in the field my_REGEX_Find.

REGEXV1 2
Example 2
REGEXV1(FIELDSTR(SERIAL_NO), '^(....)','\1CUNKA')

Your company uses a unique serial no to identify its products by appending to a vendors existing serial no.
This example is looking for the first 4 characters in the SERIAL_NO field where it will then append the text "CUNKA" into the serial number and save it in the field my_REGEX_Find.

REGEXV1 1

REMOVEBLANKLINES

Removes blanks lines from a given string.
Only lines ending with a hard return (called "Forced Line Breaks" with InDesign) are removed. Formattings tags are ignored

Parameters

REMOVEBLANKLINES()

Example
REMOVEBLANKLINES(FIELDSTR(TextWithBlankLines))

Shows text with blank lines.

REMOVEBLANKLINES1

Shows result with blank lines removed.

REMOVEBLANKLINES2

REMOVEDUPLICATES

Removes duplicate values from the given string

Parameters

REMOVEDUPLICATES(separator,string)

Example
REMOVEDUPLICATES(FIELDSTR(Delimiter),FIELDSTR(TEXT))

This example has delimited text with many duplicates. By using the REMOVEDUPLICATES we can remove the duplicate occurences between the delimiter.

The screenshot below shows the orginal text, the delimiter and the processed result in the "Display_REMOVEDUPLICATES" field.

REMOVEDUPLICATES

REPLACE

Performs a simple search-and-replace operation on the source string.

Parameters

REPLACE(source string, search text, replace text)

Example 1
REPLACE(FIELDSTR(Series), '-', '')

Find and remove all occurences of the "-" character in the "Series" field and show results in the "Display_REPLACE" field.

REPLACE
Example 2
REPLACE(FIELDSTR(Series), '-7', '**')

Find and replace all occurences of the "-7" string in the "Series" field with "**" and show results in the "Display_REPLACE" field.

REPLACE2

RESOLVEGROUPING

Resolves a parent / child hierarchy into a full path, separated by >>. group id, data source name, group field name to return, group id field name, parent group id field name

Parameters

RESOLVEGROUPING(group id, data source name, group field name to return, group id field name, parent group id field name)

Example
RESOLVEGROUPING(FIELDSTR(Group ID), groups_table, Group Name, Group ID, Parent ID)

RIGHTSTR

Returns the right part of a field

Parameters

RIGHTSTR(field name, number of characters)

Example
RIGHTSTR(FIELDSTR(Series),3)
RIGHTSTR

ROUNDVAL

Round a given value

Parameters

ROUNDVAL(value, precision, TRUE/FALSE - remove trailing zeros))

Example 1
ROUNDVAL(FIELDSTR(Price),2,FALSE)
ROUNDVAL
Example 2
ROUNDVAL(FIELDSTR(Price),2,TRUE)

Rounds to 2 decimal places and removes any trailing 0’s.

ROUNDVAL2

SENTENCECASE

Returns the contents of a field in sentence case

Parameters

SENTENCECASE(field name)

Example
SENTENCECASE(Description)
SENTENCECASE

SNIPPETDEPTH

Returns the depth in POINTS of a snippet for each record.
This command will be useful to calculate how many records can fit on a page.

For performance reasons turn off the ‘Automatically Update Content’ option on the Custom Field Field Options pane.

Parameters

SNIPPETDEPTH(file path to snippet)

Example
SNIPPETDEPTH(FIELDSTR(mySnippet))

The snippets depths are measured in points.

SNIPPETDEPTH

SNIPPETDIMENSIONS

Returns the width and height in points of a snippet when populated in a temporary document.

Parameters

SNIPPETDIMENSIONS(file path to snippet)

Example
SNIPPETDIMENSIONS('C:\\Cunka\Asia\Client7\powerdrills.idms')

SNIPPETWIDTH

Returns the width in POINTS of a snippet when populated in a temporary document

Parameters

SNIPPETWIDTH(file path to snippet)

Example
SNIPPETWIDTH(FIELDSTR(mySnippet))

The snippets widths are measured in points.

SNIPPETWIDTH

SORT

Sorts the given delimited string into ascending or descending order.

SORT also identifies numeric ranges (eg. 1-3, 3-15) as numbers. However, it only sorts the number preceeding the hyphen.

Parameters

SORT(ascending/descending,separator,string)

Example 1
SORT(TRUE,FIELDSTR(Delimiter),FIELDSTR(Text))

Sort the delimited text into ascending order. (TRUE)

SORT1
Example 2
SORT(FALSE,FIELDSTR(Delimiter),FIELDSTR(Text))

Sort the delimited text into descending order. (FALSE)

SORT2
Example 3
SORT(TRUE,FIELDSTR(Delimiter),FIELDSTR(Text))

Sort the delimited text that includes numeric ranges into ascending order. (TRUE)

SORT3

SQL

Execute an SQL statement. Data Sources are virtual tables.

Requires the Relational module.

Parameters

SQL(statement, output format (xml/html/htmlnoheader/text/textnoheader))

Example
SQL('SELECT * FROM ''ACCESSORIES'' WHERE ID = 123','HTML')

STRIPWHITESPACE

Remove whitespace from a string

Parameters

STRIPWHITESPACE( the string, (optional) TRUE to remove all whitespace, FALSE to remove just at the start and end. defaults to FALSE)

Example 1
STRIPWHITESPACE(FIELDSTR(BadText), TRUE)
STRIPWHITESPACE1
STRIPWHITESPACE2
Example 2
STRIPWHITESPACE(FIELDSTR(BadText), FALSE)
STRIPWHITESPACE3

SUB

Description

Returns the value or the secondary arguments subtracted from the first

Parameters

SUB(argument1, argument2, . . . .)

Example
SUB(FIELDSTR(CustomersPrice), FIELDSTR(Discount),FIELDSTR(Variation))

Takes the value in the field "CustomersPrice" and subtracts the values in fields "Discount" and "Variation" from it and returns the value in the field "Final_Price_SUB".

SUB

SUBSTR

Description

Returns part of a field

Parameters

SUBSTR(field name, start index starting at 0, length)

Example
SUBSTR(FIELDSTR(Name),0,4)
SUBSTR

SUM

Description

Returns the sum of the arguments

Parameters

SUM(argument1, argument2, . . . .)

Example
SUM(FIELDSTR(Price),FIELDSTR(Postage))

Takes the values in the fields "Price" & "Postage", calulates there sum and returns the value in the field "Display_SUM"

SUM

TABULARVALUE

Description

Return cell contents from the given tabular field

Parameters

TABULARVALUE(field name, field id, record id)

Example
TABULARVALUE('Accessories','1','1')

TITLECASE

Description

Returns the contents of a field in title case

Parameters

TITLECASE(field name)

Example
TITLECASE(Name)
TITLECASE

TRANSLATELANGUAGE NEW

Description

Translates the given string of text into a foreign language using a configured translation service.
(e.g. Google or DeepL)

The translation service used must be configured in the EasyCatalog Advanced Preferences before use.
TRANSLATELANGUAGE 1

If no translation service is configured you will see the 'No translation service available' message in the data source panel.

TRANSLATELANGUAGE 3

Parameters

Optional last parameter specifies which service to use, either DeepL or Google
TRANSLATELANGUAGE(string, to locale, from locale(optional), service(optional))

Example

Translate English into both German And Italian.

TRANSLATELANGUAGE(FIELDSTR(ENGLISH_WORD),'de','en','Google')

TRANSLATELANGUAGE(FIELDSTR(ENGLISH_WORD),'it','en','Google')
TRANSLATELANGUAGE 2

TRUNCATESTR

Description

Removes the last N characters from a string

Parameters

TRUNCATESTR(string, number of characters to remove)

Example
TRUNCATESTR(FIELDSTR(Text),4)
TRUNCATESTR

UNIQUESTR

Description

Return the unique entries in a given string input

Parameters

UNIQUESTR(string, input separator, output separator)

Example
UNIQUESTR(FIELDSTR(Text),',','|')

Works in a similar way to the REMOVEDUPLICATES command.

UNIQUESTR

UPC

Description

Returns a UPC barcode.

Requires the font CarolinaBarUPC.

Parameters

UPC(numerical value)

Example
UPC(UPCcode)
UPC

UPPER

Description

Returns the contents of a field in upper case

Parameters

UPPER(field name)

Example
UPPER(Brand)
UPPER

URLDECODE

Description

Decodes the given URL string. URL must begin with 'http' or 'https'.
For security purposes, its best to use only URLs that begin with 'https'.

Parameters

URLDECODE(string to decode)

Example
URLDECODE(FIELDSTR('EncodedURL'))
URLDECODE

URLENCODE

Description

Encodes the given URL string. URL must begin with 'http' or 'https'.
For security purposes, its best to use only URLs that begin with 'https'.

Parameters

URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits.

URLENCODE(string to encode)

Example
URLENCODE(FIELDSTR('Image Names'))
URLENCODE

URLSTR

Description

Retrieves a string from a URL

Parameters

URLSTR(url string, (optional) username and password seperated by a colon for HTTP authentication)

Example 1
URLSTR(http://feeds.bbci.co.uk/news/rss.xml)
Example 2

Getting a string from a URL that requires password authentication

URLSTR(‘https://www.mywebsite’,’jdoe:password’)

WORDWRAP

Description

Word wraps the given string to a specified line length

Parameters

WORDWRAP(string, line length, break character (optional))

Example
WORDWRAP(FIELDSTR(Text),4,^n)
WORDWRAP1
WORDWRAP2

XREFFIELD

Description

Returns the value of a field from another record.
Returns the first instance found.

There is an option to do advanced cross referencing across data sources

Searches can be a "search for" using the % character in the search string as a prefix and suffix. This allows searching the beginning of a string, the ending of a string, or whether a string contains specific content.

  • Containing
    % character at the prefix and suffix of the search string.
    Search anywhere in the string for the characters "XXXX". eg. '%XXXX%'

  • Begins with
    % character at the suffix of the search string.
    Search the beginning of the string for "CatNo.". eg. 'CatNo.%'

  • Ends with
    % character at the prefix of the search string.
    Search the end of a string for the image extension ".JPG". eg. '%.JPG'

Parameters

XREFFIELD(field to search, field content to search for, field contents to return, (optional) data source to search)

Example
XREFFIELD('PartNo',FIELDSTR('xRefPartNo'),'Page')

This example shows the cross referencing of a product items page (Cordless Drill) and an accessories page (batteries).

XREFFIELD

XREFFIELDLIST

Description

Works as per XREFFIELD, but this function will return a separated list of results

Parameters

XREFFIELD(field to search, field content to search for, field contents to return, (optional) first separator, (optional) middle separator, (optional) end separator, (optional) data source to search)

Example 1
XREFFIELDLIST('PartNo',FIELDSTR('XRefPartNo'),'Page',',',',',' and ')
Example 2 Beginning with "light"
XREFFIELDLIST('COLOR_NAME','light%','COLOR_NAME')
XREFFIELDLIST1
Example 3 Contains "sky"
XREFFIELDLIST('COLOR_NAME','%sky%','COLOR_NAME')
XREFFIELDLIST2
Example 4 Ends with "y"
XREFFIELDLIST('COLOR_NAME','%y','COLOR_NAME')
XREFFIELDLIST3

Automation with EasyCatalog

EasyCatalog can use any of the three available scripting languages that InDesign uses. The focus here is Adobes flavour of JavaScript and EasyCatalogs inbuilt adaption of the LUA programming language.

JavaScript control of EasyCatalog requires the purchase of the optional Scripting plug-in available from 65bit. No additional modules are required for programming with LUA.

Paginating large catalogues

<COMING SOON>

INDESIGN

Close dialog windows

With InDesign, its quite easy to run with a lot of dialog windows open. This can become a problem with documents adding up to hundreds of pages. +

Resources on speeding up InDesign

David Blatner’s article called Why is InDesign so slow? : https://indesignsecrets.com/why-is-indesign-soooo-slow.php

Erica Gamet’s article called 6 Tips to Speed Up InDesign : https://indesignsecrets.com/6-tips-speed-up-indesign.php

EASYCATALOG

Many open data source panels

If you are doing a lot of development with EasyCatalog, its quite easy to accumulate a lot of open data source panels. The panels dont need to be visible, they only need to be open. This means EasyCatalog will be loading and tracking them, as well as InDesign.

Now with small data source panels, this may not become an issue. However, if you are dealing with thousands of records with many panels open, you will notice sluggish behaviour from EasyCatalog and InDesign. Shut down and close panels you are not using.

Configuration files

<TO DO>

Stay up to date

Due to a change with InDesign we started noticing a script ran for 4 hours started hitting 5 hours for pagination for a 1000 page catalogue. Our analysis showed the size of the data had not increased, nor the complexity of the pagination in the libraries. After a few weeks of testing the previous version of EasyCatalog/InDesign and the newer versions, we found that InDesign was activating the "preflight" panel while paginating. This added a lot of overhead into InDesign as the preflight was now checking the pages as EasyCatalog was doing its work !

As a consequence, we notified 65bit who then fixed the issue with an update. As of version 14.0.0 automatic pre-flight is now disabled while before pagination commences. Stay up to date with EasyCatalog.

Using LUA sockets slows performance

Setting "Enable Sockets" to TRUE is only useful for debugging LUA. It can also slow the performance of EasyCatalog. When running scripts, ensure you have turned this parameter back to FALSE.

InDesign Preferences → EasyCatalog → Advanced → LUA "Enable Sockets"

Adobe InDesign Javascript

ScriptUI Dialog Builder

Chrome browser only.
Main Dialog building screen

Joonas Paakko has programmed this very helpful tool for building InDesign dialogs called ScriptUI Dialog Builder.

Go to the ScriptUI Dialog Builder site : https://scriptui.joonas.me/

The Github page for the project is located here : https://github.com/joonaspaakko/ScriptUI-Dialog-Builder-Joonas

Exported code from Dialog Builder

Using VSCode for Scripts

VSCode is one of the favourite leading code editors going around these days. It comes as no surprise that Adobe has created an extension for it called Extendscript Debugger for script writing and debugging.

It is a near perfect replacement for Adobes existing ExtendScript App, and its maintained by Adobe!

VSCode Adobe 1

My Installation of Extendscript Debugger

Use the installation and setup notes provided by Adobe in the link above.


The details that follow is how I installed Extendscript Debugger on my PC and screenshots of what it looks like.
  1. A folder exists on my PC where some of ExtendScripts are currently located. This folder will be used to inform the Extendscript Debugger that the scripts are located here.

    VSCode Adobe 2
  2. I clicked the Debug and Run option on the left side of VSCode. Then clicked on "create a launch.json file" and selected ExtendScript Debug from the dropdown.

    VSCode Adobe 3
  3. This is the one tedious bit using VSCode and running scripts. You must have a configuration set up for every script. Its nothing complicated, and you can add as many as you want.

    VSCode Adobe 4

    By default you only have to edit the first configuration to use your first script.

    • "name":
      The title of the script. Call it what you want as its used in a dropdown for to use later on.

    • "program":
      Is the name of the jsx script you want debug/run.

Make sure to save the launch.json file
  1. The script now becomes available to DEBUG AND RUN.

    However, there is still one more step.

    VSCode Adobe 5
  2. Just like using Extendscript, you must indicate to VSCode what the target application will be.

    You can see in the example below that VSCode looks very similar to Extendscript with windows for Variables, Watch, Call Stack, Breakpoints.

    VSCode Adobe 6

Determine the users operating system

operatingSystem = $.os.indexOf('Win') >= 0 ? "Windows": "Mac";

File path seperator

If you plan on retrieving or saving files through scripting, you can use through the operating system discovery to determine which directory seperator to use.

File paths can be different from Windows to a Mac. If a script may run on either, its best to get the script to determine what directory seperator to use and hold the result in a variable.

dirSeparator = $.os.indexOf('Win') >= 0 ? "//": "\";

Track the time taken

With long running processes, its handy to know how long a script will take to run.

$.hiresTimer; // starts the timer.
// Final script time taken calculation
var time = $.hiresTimer / 1000000;
alert("Total Time : " + time.toFixed(2) + " seconds");

Improve InDesigns speed

app.scriptPreferences.enableRedraw = false;

Close all currently open InDesign libraries

You can close all the currently open InDesign libraries in various ways. Here is the shortest method.

app.libraries.everyItem().close();

Here is the longer method.

var myLibraries = app.libraries; // get all open libraries
if (myLibraries.length > 0) {
    var libraryNames = (myLibraries.everyItem(0).name).toString(); // string containing all library names
    for (var i = myLibraries.length - 1; i > -1; i--) { // looping backwards because closing libraries changes the indexes
        if (myLibraries[i].associatedPanel != null && myLibraries[i].associatedPanel.visible == true) {
            myLibraries[i].associatedPanel.visible = false;
        }
        myLibraries[i].close(); // file closed
    }
}

Close all the documents currently open

The following will close all the open documents without saving.

app.documents.everyItem().close(SaveOptions.NO);

Applying InDesign master pages

// Get the currently opened document
myDoc = app.activeDocument;

// Get the first page and change the master spread to "D-Delta"
myDoc.pages.firstItem().appliedMaster = myDoc.masterSpreads.item("D-Delta");
InDesign Master Page

Using layers

Layers allow you a greater depth of design flexibility with an InDesign template. EasyCatalog "furniture" and libraries can be easily used.

You should always make sure you are paginating with EasyCatalog into the "active" layer. Otherwise you will see blank pages.
Layers 1

Make a layer visible.

myDoc = app.activeDocument;
myDoc.layers.itemByName("Red").visible = true;

Hide a layer.

myDoc = app.activeDocument;
myDoc.layers.itemByName("Red").visible = false;

Set a layer to be "active".

//Set the active layer
myDoc = app.activeDocument;
myDoc.activeLayer = myDoc.layers.itemByName("Green");

Create a log file

A log file is very handy to have to track progress of a script, keep data on what was used, or simply diagnose issues.

The code below uses a timestamp to put into the file name. The actualy writting of the text file is handled through a function called logWrite(text). You simply call the function when you want something written into a log file. It will calculate the time and if a file exists, it will append to it, or create a new file should one not exist.

var timeNum = new Date().getTime();  // used if you create a log file that requires a time stamp
function logWrite(text) { // write the logging file
    var myTextFilePath = logFilePath + timeNum + "_log.txt";
    var myTextFile = new File(myTextFilePath);
    if (myTextFile.exists) {
        myTextFile.open("e");
        myTextFile.seek(0, 2);
    } else {
        myTextFile.open("w");
    }
    var d = new Date().toLocaleString();
    myTextFile.write(d + " ");
    myTextFile.write(text);
    myTextFile.close();
}

Example of writing text to the file.

…​. // write text to a file
logWrite("Begin STAGE 1");
…​. // do some EasyCatalog pagination
…​. // write more text to the file
logWrite("STAGE 1 has completed.");

Additional resources

The InDesign JavaScript Reference Guide
http://jongware.mit.edu/idcs6js/index.html

The InDesign scripting playground
http://www.indiscripts.com/

InDesign scripts by Peter Kahrel
http://www.kahrel.plus.com/indesignscripts.html

EasyCatalog Javascript

Scripting Module Documentation

EasyCatalog Scripting Guide

The "EasyCatalog Object"

EasyCatalog scripting begins with the creation of the "EasyCatalog Object".

var myEasyCatalog = app.easycatalogObject;

Alternatively, you can skip storing the object in a variable and continue to reference it directly. Examples throughout this guide will reference the EasyCatalog Object directly, but its more common to use a variable.

Here is an example showing the EasyCatalog Object usage in both instances and both result in the same thing.

var myEasyCatalog = app.easycatalogObject;
var myDataSources = myEasyCatalog.datasources.everyItem().name;
//
// Above is the same as below
//
var myDataSources = app.easycatalogObject.datasources.everyItem().name;

Data Sources

All EasyCatalog Data Sources must exist in the "EasyCatalog Workspace" folder.

A Data Source can be referenced directly.

var myDS = app.easycatalogObject.datasources.item("ElectronicParts.xlsx")

Alternatively, you can also collect all available Data Sources in an array and choose one.

var myDataSources = app.easycatalogObject.datasources.everyItem().name;

To make all the data sources easily selectable, use a dropdown box in a panel.

var srcnameField = dropdowns.add({stringList: myDataSources, selectedIndex: 0});

The value srcnameField is used to capture the selected data source from the myDataSources array.

var dataSourceName = myDataSources[srcnameField.selectedIndex];

Use selected the Data Source selected from the array.

try { //ensure the data source name is valid
    var myDS = app.easycatalogObject.datasources.item(dataSourceName);
    var myDV = myDS.dataviews.item(dataSourceName);
    alert("Data Source File: " +myDS.dataSourceSpecifier);
} catch (err) {
    alert("Cannot find data source " + dataSourceName);
    exit();
}

Data Views

/*
**********************************************************

Purpose - to find only the currently "open" data views.
This can then be used in a dropdown box for users to select.

by Brian Cowell
https://www.cunka.com/easycatalog/myEasyCatalog.html

**********************************************************

*/

var myDVs =[]; // array to hold the open data views

// Create an array of available EasyCatalog data sources
var myDataSources = app.easycatalogObject.datasources.everyItem().name;
var myDataViews= app.easycatalogObject.dataviews.everyItem().name;

// loop through all the dataviews
for (var key in myDataViews ){
    var myDS = app.easycatalogObject.datasources.item(myDataViews[key]);
    // find if the dataview is currently "open"
    if (myDS.dataviews.item(myDataViews[key]).visible==true){
        myDVs.push(myDataViews[key]);
    }
}
Dataview 1

Using configuration files

Data panels can be set up so you can group your structure and apply a sort order to your data source. You can easily save your settings as a "configuration file".

EasyCatalog allows you to change between different configuration files quickly and easily. As an example, you may have a configuration file that generates all your contents, and another that creates your index.

myDV.applyConfiguration("Catalogue_contents");
//…​…​…​..
// Paginate the catalogue contents
// …​…​…​.
// Now change to a different configuration
myDV.applyConfiguration("Catalogue_index");
EasyCatalog Workspace Folder location

Close all open Data Sources

You can easily close all the open panels (Data Sources)

app.easycatalogObject.dataviews.everyItem().closeDataView();

Capturing pagination code

If you can manually paginate your document, you can automate it.
At the pagination dialog, EasyCatalog gives you the opportunity to copy to the clipboard the Javascript settings to use in your script.

To capture to the clipboard, click on the symbol on the bottom left of the paginate dialog window.

Example code:
myDSO.setPaginationOption("assettype","1")
myDSO.setPaginationOption("paginationtype","0")
myDSO.setPaginationOption("assetfield","")
myDSO.setPaginationOption("usegeometry","false")
myDSO.setPaginationOption("paginationlogic","1")
myDSO.setPaginationOption("librarylocation","")
myDSO.setPaginationOption("rulesetname","CUNKA_COLORS")
myDSO.setPaginationOption("insertpages","true")
myDSO.setPaginationOption("undosupport","true")
myDSO.setPaginationOption("continueonerror","false")
myDSO.setPaginationOption("optimizedcopy","false")
myDSO.setPaginationOption("updatefurnitureafterpagination","false")
myDSO.setPaginationOption("masterpaginationtype","0")
myDSO.setPaginationOption("flowbasedstylename","")
myDSO.setPaginationOption("restrictverticalmergetopagebounds","false")
myDSO.setPaginationOption("autoapplyparaspacebefore","false")
myDSO.setPaginationOption("flowbreakonfield","")
myDSO.setPaginationOption("flowbreakonfieldbreaktype","1")
myDSO.setPaginationOption("flowprocessfurnitureduringpagination","false")
myDSO.setPaginationOption("maximumnumberofpages","0")

Pagination script code

Capturing pagination rule code

Right click on an "Action" in the Pagination Rules window and select Copy Script Call.
This will capture to the clipboard the Javascript code for the "Action" for use in a script.

Formatting rule code

Example Code :
app.easycatalogObject.setPaginationRule(myPageItem,"Brand","0x53500kInCatContainsNameKey","Panasonic","eShow");

Formatting rule code

Example Code:
app.easycatalogObject.setPaginationRule(myPageItem,"0x92100kFittingAttributeStringKey","0x92100kFittingAttributeValueFrameToContent");

EasyCatalog LUA

LUA Documentation

To find more detail on EasyCatalog and its Lua programming language implementation :

EasyCatalog LUA Documentation

Set up "Enable Sockets"

Debugging LUA can be done remotely through the LUA ZeroBrane Studio IDE editor.
To connect the editor to EasyCatalog you need change the LUA Enable Socket parameter from FALSE to TRUE in the EasyCatalog Preferences panel.

Setting "Enable socket" to TRUE can slow down the performance of EasyCatalog.
It is recommended to return the setting back to FALSE when not debugging LUA.

The InDesign Preferences panel : Preferences → EasyCatalog → Advanced → LUA - Enable Sockets

LUA Enable socket preference

Debugging EasyCatalog LUA with ZeroBrane

Debugging LUA scripts through the InDesign UI can be very non intuitive to use.
However, with the aid of the ZeroBrane Studio editor you can debug your LUA code in EasyCatalog while running InDesign.

Download ZeroBrane Studio (free)

The ZeroBrane Studio editor is free to download and use.
https://studio.zerobrane.com/

EasyCatalog LUA "Enable Sockets"

In order to debug with the use of the ZeroBrane Studio editor, EasyCatalog must have the Enable Sockets preference set to true.
Go to our set up "Enable Sockets" section for more information.

EasyCatalog LUA ZeroBrane4

Debugging example

To get ZeroBrane Studio and EasyCatalog to "talk" to each other, we need to include 2 LUA libraries called :

  • mobdebug.lua

  • socket.lua

You can find these both these libraries in your installation of the ZeroBrane Editor in the lualibs folder.

EasyCatalog LUA ZeroBrane7

Copy mobdebug.lua & socket.lua into your EasyCatalog Workspace "Scripts" folder.
Screen shot shows our "CUNKA Test Panel".

EasyCatalog LUA ZeroBrane6

In the ZeroBrane Studio editor we need to start the "debugging server".
Go to Project → Start Debugger Server

EasyCatalog LUA ZeroBrane5

This example I’m testing out LUA code in an advanced field.

That the line require('mobdebug').start() is at the start of the code and should only be used for debugging sessions.

Press the Test button and the debugging session begins.

EasyCatalog LUA ZeroBrane8

At this point the ZeroBrane editor may ask you if you want to save the untitled LUA file, simply save it anywhere, its part of the debugging session.

You should see your code with the green arrow pointer indicating what line the code is at, but has not yet executed.

I’ve set up a "Watch" window and added the variables I want to study in this session. Also, I have the "Remote Console" open so I can type in and test values as well as test code.

The additional box I’ve indicated on the top task bar is the "Step Into" icon.
This allows you to execute 1 line at a time.

EasyCatalog LUA ZeroBrane2

This is the results of the session running.

I was trying to find out why in this example, why the EasyCatalog field was appearing with an empty value, thus I needed to debug and find out why.

You can clearly see in the "Watch" variables that the code has values and the error I was having was related to the type of data I was returning.

In the "Remote Console" you can see I was checking the value of an array.

ZeroBrane editor is handy to find out why things do not work as expected and shortens your development time.

EasyCatalog LUA ZeroBrane3

Script - createcontent.lua

The createcontent.lua script is executed immediately after EasyCatalog loads data from a data source, but before additional processing.

createcontent.lua

  • Script must be created and saved into the Scripts folder of the workspace

  • Is run by EasyCatalog after synchronizing the data source panel

  • Gets passed a records variable which is a RECORDSET object representing the raw data from the data source.

  • Can create new fields

  • Can remove fields

  • Can rename fields

  • Can set field content

  • Potentially could incorporate data from other sources into a single set of data, or pull different language fields based on data source options.

Removing unwanted FIELDs

There will be occasions where you have limited control over the source data used for the data source panel.
This can result in a pollution of unwanted fields that have nothing to contribute to the final pagination.

Through the use of a LUA script called createcontent.lua , it is possible to remove all unwanted fields.

Example

This data source panel has a few fields that are not required. They will be removed using the createcontent.lua script.

FIELDS to be removed
  • INTERNATIONAL_PID

  • INTERNATIONAL_PID_TYPE

  • SPECIAL_TREATMENT_CLASS

  • UDX_TRANSPORT

This is how the data source panel (CUNKA_DOORS.xlsx) is originally set up.
LUA createcontent.lua

The script createcontent.lua is created with instructions to remove the fields INTERNATIONAL_PID,
INTERNATIONAL_PID_TYPE, SPECIAL_TREATMENT_CLASS and UDX_TRANSPORT.

LUA createcontent.lua

The createcontent.lua script is saved in the CUNKA_DOORS.xlsx Scripts folder.

LUA createcontent.lua

LUA createcontent.lua

LUA createcontent.lua

Synchronize the data source panel.

LUA createcontent.lua

LUA createcontent.lua

The fields are removed from the data source panel.

LUA createcontent.lua

Rename existing FIELDs'

The existing data source panel fields can be renamed'

Through the use of a LUA script called createcontent.lua , it is possible to rename any fields.

This will affect any custom fields or scripts that use the old name of the field.
Example
FIELDS to be renamed
  • PRODUCT_TYPE to be renamed Category

  • PRODUCT_SERIES to be renamed Series

  • PRODUCT_CODE to be renamed Series Code

This is how the data source panel (CUNKA_DOORS.xlsx) looks pre-renaming the fields.
LUA createcontent.lua

The script createcontent.lua is created with instructions to rename the fields PRODUCT_TYPE, PRODUCT_SERIES and PRODUCT_CODE.

LUA createcontent.lua

Synchronize the data source panel.

LUA createcontent.lua

LUA createcontent.lua

The fields are now renamed in the data source panel.
Fields that have been renamed will appear with an indication icon of the change. (Circle with a plus in it)

LUA createcontent.lua

Get a records contents using FIELD

Using the FIELD parameter, a reference to a field name for a record can be called using FIELD.get('XXXXX')
The contents for that field can be retrieved by using :content().

Example 1

This is a simple concatenation of two fields of a record using FIELD and returned as a new value.

-- Use FIELD to retrieve a fields content of the current record. This is grabbing the PartNo.
firstThing = FIELD.get('PartNo'):content();

-- Use FIELD to grab the current records contents. This is grabbing the xRefPartNo.
nextThing = FIELD.get('xRefPartNo'):content();

-- Simple concatenation of strings and return the result
return firstThing.." --> (Spare battery) "..nextThing;

LUA FIELDgetcontent2

LUA FIELDgetcontent

Example 2

Using a FIELD called 'Name', use that records content to first filter results, then return a tabular table.

-- Get the list of records
recordset = DATASOURCE.get():getrecordset()

-- Get the records content for the field 'Name'
currentName = FIELD.get('Name'):content();

-- Create a filter on the Name field looking for the current value of the variable currentName
filteredset = recordset:filter('Name',currentName)

-- Convert the fields of all the records to columns and rows into a table
-- use the following fields
result = filteredset:tableof('PartNo','Name','Type')

-- Pass the new table back to the tabular field
return result:present()

LUA FIELDgetcontent4

LUA FIELDgetcontent3

Capturing Errors

There are occasions where errors can occur when the code is been executed on the page. Unfortunately, an error can stop any kind of pagination dead in its tracks.

The LUA programming language comes with a few methods to capture errors.

Example 1 - Error with unknown field

In this example, when the field ID value is less than 50 the fields PART_NO1 and PART_NO2 are inserted to the text frame.

The problem is the field PART_NO2 does not exist.

[[
    value = tonumber(field('ID'))
    if (value < 50) then TEXT.insertfield('PART_NO1') TEXT.insertfield('PART_NO2');
    end
]]

LUA Easycatalog errors1

The result is pagination crashes out with an error.

LUA Easycatalog errors2

Example 2 - Capture the unknown field

This example is a continuation of Example 1. The goal is to capture the error and just continue with pagination. The code still uses a field called PART_NO2 that doesnt exist and will cause an error.

To capture any errors we will wrap them up in the LUA pcall() command. We wrap our conditions in a function called myfunction() and use pcall(myfunction) to call it.

[[
    function myfunction()
        value = tonumber(field('ID'))
        if (value < 50) then TEXT.insertfield('PART_NO1') TEXT.insertfield('PART_NO2');
        end;
    end;
    pcall(myfunction)
]]

LUA Easycatalog errors3

The result shows that even though the field PART_NO2 doesnt exist, the field PART_NO1 is still inserted into the text frame. (The ID is less than 50)

LUA Easycatalog errors4

TableOf

Using TableOf, fields(s) can be grouped into a table and the result returned into a Tabular field.
By default if no field names are stipulated, the table returned is of the whole data panel.

The EasyCatalog field must be set up to be a tabular field.

LUA TableOf panel3

Example 1

No field names are stipulated to TableOf, so everything is returned to the tabular field.

-- Get the list of records
recordset = DATASOURCE.get():getrecordset()

-- Convert the fields of all the records to columns and rows into a table
-- By default, if no fields are specified all fields are used.
result = recordset:tableof()

-- Pass the new table back to the tabular field
return result:present()

LUA TableOf panel4

LUA TableOf panel

LUA TableOf panel2

Example 2

The TableOf parameter is now instructed to return a table made up from the 'PartNo','Name' & 'Type' fields.

-- Get the list of records
recordset = DATASOURCE.get():getrecordset()

-- Convert the fields of all the records to columns and rows into a table
-- Specify fields to use.
result = recordset:tableof('PartNo','Name','Type')

-- Pass the new table back to the tabular field
return result:present()

LUA TableOf panel5

Sorting a recordset

A recordset can be sorted further through the use of the :sort() method.
The :sort() method takes 1 or more field names to sort by.

Example

This example is asking the recordset to be sorted by the 'PartNo' field.

-- Get the list of records
recordset = DATASOURCE.get():getrecordset()

-- Sort the list of records by PartNo
recordset:sort('PartNo')

-- Convert the fields of all the records to columns and rows into a table
-- Specify fields to use.
result = recordset:tableof('PartNo','Name','Type')

-- Pass the new table back to the tabular field
return result:present()

Filtering a recordset

While having access to a recordset is handy, been able to filter the data down to a specific set of records can be a powerful tool. Through the use of the :filter() method, its possible within LUA to filter the recordset.

The :filter() method takes a minimum of two parameters. The field name and value.

Example

In this example the recordset is been asked to filter by the field name 'Name' and the value of 'Ryobi'. The new filtered recordset is stored in the variable filteredset.

-- Get the list of records
recordset = DATASOURCE.get():getrecordset()

-- Create a filter on the Name field looking for anything by Ryobi
filteredset = recordset:filter('Name','Ryobi')

-- Convert the fields of all the records to columns and rows into a table
-- use the following fields
result = filteredset:tableof('PartNo','Name','Type')

-- Pass the new table back to the tabular field
return result:present()

LUA Recordset filter

LUA Recordset filter2

Styling a tabular table

When a table is created in LUA, you can return the tabular table back with an existing InDesign Table style that exists in your document.
To do this, you use the :setstyle() method for tables and the name of the Table style in InDesign

Example

The table style 'Products' is applied to the tabular table.

-- Get the list of records
recordset = DATASOURCE.get():getrecordset()

-- Sort the list of records by PartNo
recordset:sort('PartNo')

-- Convert the fields of all the records to columns and rows into a table
-- Specify fields to use.
result = recordset:tableof('PartNo','Name','Type')

-- Use an existing InDesign table style to make the table pretty
result:setstyle("Products")

-- Pass the new table back to the tabular field
return result:present()

LUA TableStyle

LUA TableStyle2

Connecting to the Internet

Example 1

In this example we want to get a list of CSS color names from a webpage located on the Github website. The file returned is a JSON string.

-- URL string
url = "https://raw.githubusercontent.com/bahamas10/css-color-names/master/css-color-names.json";

-- Connect to this URL
response_code, response_body =  HTTP.get(url);

-- Check the server response
if response_code ~= 200 and response_code ~= 401 then
  error(response_code .. response_body);
end

-- Pass the result to the EasyCatalog field
return response_body

EasyCatalog LUA http1

Controlling a Frame from a Script Label

LUA commands can be used to control the behaviour of a Frame through the script label.

Example 1

The script label has LUA code in it, which on pagination determines from the field 'Brand' what objectstyle to apply to the frame. If its "Panasonic", it chooses one color, if its "Samsung" it chooses another.

getBrand = FIELD.get('Brand'):content()
if(getBrand=="Panasonic") then
  frame:applyobjectstyle("Panasonic")
else
  frame:applyobjectstyle("Samsung")
end

LUA Frame and script label

Example 2

The script label contains LUA code, that at the time of pagination, will take some of the frames attributes and update fields back into the data source panel.

In this example the top left corner X/Y position of the frame are captured and updated into a record that has the fields of X_POSITION_IMAGE and Y_POSITION_IMAGE.

width = frame:width()
height = frame:height()
left = frame:left()
top = frame:top()
FIELD.get('X_POSITION_IMAGE'):setcontent(left)
FIELD.get('Y_POSITION_IMAGE'):setcontent(top)

LUA Frame with script label

Using Appearance to change the panel style

Each field in the datasource panel allows you to control how its displayed through the "Appearance" tab. With the use of color you can easily color co-ordinate your fields amongst many fields to display a better user experience.

The "Appearance" parameter goes one step further through the use of LUA. You can code in shapes (circles, squares) as well as custom colors. It also allows you to "conditionally" apply the shapes and color that are determined through field values.

You will see drawrect(x,y,width,height) used without x,y,width,height been declared. If you dont supply values in these fields, it defaults to its own internal values.

LUA Appearance 1

LUA Appearance 2

LUA Appearance 3

Example 1

This example uses conditions to define the "Appearance".
Through the 'Brand' field, the datasource is color co-ordinated dependent on whether 'Brand' contains the value 'Panasonic'. If it does the cells are colored Purple, if it isn’t the cell is colored Brick Red.

LUA Appearance 4

if field('Brand') == "Panasonic" then

-- set color to Purple
  setopacity(0.2)
  setcolor(102,0,102)
  drawrect(x,y,width,height)
else

-- set color to Brick Red
  setopacity(0.2)
  setcolor(153,0,0)
  drawrect(x,y,width,height)
end
Example 2

Easily change the "Appearance" colors. This example shows how to easily remove the LUA opacity setting to make colors brighter.

Appearance Colors

Appearance Color Table

Appearance Color Name

RGBA with opacity

RGB without opacity

Light blue

79, 153, 255, 0.2

79, 153, 255

Red

255, 0, 0, 0.2

255, 0, 0

Green

79, 255, 79, 0.2

79, 255, 79

Blue

0, 0, 255, 0.2

0, 0, 255

Yellow

255, 255, 79, 0.2

255, 255, 79

Magenta

255, 79, 255, 0.2

255, 79, 255

Cyan

0,255,255,0.2

0,255,255

Gray

127,127,127,0.2

127,127,127

Black

0,0,0,0.2

0,0,0

Orange

255,102,0,0.2

255,102,0

Dark Green

0,84,0,0.2

0,84,0

Teal

0,153,153,0.2

0,153,153

Tan

204,153,102,0.2

204,153,102

Brown

153,51,0,0.2

153,51,0

Violet

153,51,255,0.2

153,51,255

Gold

255,153,0,0.2

255,153,0

Dark Blue

0,0,135,0.2

0,0,135

Pink

255,153,204,0.2

255,153,204

Lavender

153,153,255,0.2

153,153,255

Brick Red

153,0,0,0.2

153,0,0

Olive Green

102,102,0,0.2

102,102,0

Peach

255,153,153,0.2

255,153,153

Burgundy

153,0,51,0.2

153,0,51

Grass Green

153,204,0,0.2

153,204,0

Ochre

153,102,0,0.2

153,102,0

Purple

102,0,102,0.2

102,0,102

Light Gray

186,186,18,0.2

186,186,18

Charcoal

170,163,181,0.2

170,163,181

Grid Blue

122,186,216,0.2

122,186,216

Grid Orange

255,181,107,0.2

255,181,107

Fiesta

247,89,107,0.2

247,89,107

Light Olive

140,165,107,0.2

140,165,107

Lipstick

206,130,181,0.2

206,130,181

Cute Teal

130,206,193,0.2

130,206,193

Sulphur

206,206,130,0.2

206,206,130

Grid Green

155,221,155,0.2

155,221,155

White

255,255,255,0.2

255,255,255

Overview of DOCUMENT

LUA TableStyle

LUA TableStyle

LUA TableStyle

Overview of FIELD

LUA Field

Overview of RECORD

LUA Record

Overview of TEXT

LUA Text

Event Scripts

What are Event Scripts?

External scripts can be created and called in response to certain events in EasyCatalog. These are known as Event Scripts.

Event Scripts are programmed using Adobe Javascript. They are required to be placed in the Scripts sub folder located in the Data Source workspace.

Event Script parameters are accessed by the application object scriptArgs

// Example
var myID = Number(app.scriptArgs.getValue("id"));

PostLoadDataSource.jsx

250

Called after loading a Data Source into memory.

Parameters

datasource

//
// PostLoadDataSource.jsx
//
//
// by Brian Cowell
// http://www.cunka.com/easycatalog/myEasyCatalog.html
//
//
// OBJECTIVE : Get information the data source when the panel is loaded up.
//
//

// writes the Adobe ExtendScript console if it is open

$.writeln("---- POST LOAD DATA SOURCE SCRIPT ----");

// get the current data source name passed by the script

var ds = app.scriptArgs.getValue('datasource');
$.writeln("Loaded DATA SOURCE : "+ds);

var myDS = app.easycatalogObject.datasources.item(ds);
var myDV = myDS.dataviews.item(ds);
$.writeln("DATA SOURCE state : "+myDS.loadState);

var myDSFields = myDS.fieldNames;
$.writeln("Total Fields : "+myDSFields.length);

PostSynchronizeWithDataSource.jsx

300

Called after synchronizing the panel with the Data Source.

Parameters

datasource

PostPurgeDeleted.jsx

120

Called after removing records marked as deleted.

Parameters

datasource

PrePaginateDocument.jsx

Called just before paginating a document.

300
//
// PrePaginateDocument.jsx
//
//
// by Brian Cowell
// http://www.cunka.com/easycatalog/myEasyCatalog.html
//
//
// OBJECTIVE : Test to make sure Fields exist before paginating. If they DO NOT exist, the script will create them.
//
//

// writes the Adobe ExtendScript console if it is open

$.writeln("---- PRE PAGINATION SCRIPT ----");

// The field names we will be testing to make sure exists.

var fieldTestList =[
    "materialColor",
    "materialType",
    "materialTable",
    "selectionTable",
   "flammabilityRating"
];

// Get the currently selected Data Source

var ec = app.easycatalogObject;
var myDSV = ec.selectedDataView();
var myDS = myDSV.parent;

$.writeln(myDS.dataSourceName); // write the data source name to the console

// loop through list of fields to check
for (i = 0; i < fieldTestList.length; i++) {
    try{
        var option = myDS.getFieldOption(fieldTestList[i], "name");
        //$.writeln("Confirm field "+fieldTestList[i]+" exists.");
    }
    catch(err){
        custField(fieldTestList[i],""); // create field if it doesnt exist
        //$.writeln("Create custom field to replace missing field "+fieldTestList[i]);
    }
}

///////////////////////////////////////////////////////////////////

// Function to create the custom fileds
function custField(fieldName,fieldContent){
    try{
        myDS.addCustomField(fieldName,fieldContent);
        $.writeln("Created custom field : "+fieldName);
        }
    catch(err){
        $.writeln("FAILED to create custom field : "+fieldName);
        }
}

PostPaginateDocument.jsx

300

Called after document pagination

Parameters

datasource, documentTitle

PreUpdateDocument.jsx

400

Called before updating a document.

PostUpdateDocument.jsx

400

Called around updating fields in a document.

Parameters

datasource, document

PreImageImport.jsx

Called before importing an image.

PostImageImport.jsx

Called around image updates.

Parameters

datasource, field, key, id

PostPaginateItem.jsx

Master based pagination only.

150

Called after paginating an item.

Parameters

datasource, key, documentTitle, id

PaginationProgress.jsx

200

Called during pagination

Works with ADOBE InDesign Server only.

Parameters

datasource, stepindex, stepindex, stepmessage, id

XML Data Provider Module

Getting Help

Brian Cowell can be contacted at contact@cunka.com

©2019-2023 Brian Cowell