Data Styling

Cacidi Extreme/LiveMerge offers a very powerful way to style or manipulate your data source based on a wide varity of rules and actions. This Data Styling will be applied in-memory prior to the data being merged into your Item Designs upon a Production and thus enables you to manipulate your data in any conceivable way you can imagine.

Why use Data Styling?
In almost every data based design production there is always the need to manipulate the data in one way or another that will make the end result just a little bit closer to the final desire.
Using Data Styling you could for example create a rule that would add the VAT to a price column and enter the calculated new price into a new column or Merge Field. You could also use Data Styling to create a set of EXIF checks directly into your data thus removing the need for EXIF codes in your Item Designs.
Or you could create a complex rule set that checks for the length of a certain Merge Field and the number of line breaks in another field and based on that, apply a specific Item Design to each record and enter this information into a virtual ItemDesign Merge field to be used with an AutoCalc. Height and Width information can then be set according to the selected Item Design.

These are just a few examples for the possible Data Manipulations that can be done using Data Styling. Below is a complete list of the features available.

Applying Data Styling
To use Data Styling to a Cacidi Project you will need to create a Data Styling XML based file that describes all the data manipulations and rules you want to apply. Then, point to this file in the Project Settings using the Styling File option. Note, that if you only want a simple Word Styling, the file should be a normal text file with the .txt extension (see the chapter Stylistic Word styling for more information on this).

Structure of the Data Styling xml file
Each set of rules or data manipulations in the Data Styling file is encapsulated by a Process tag. Each Process block then have three mandatory tags for data input, output and parameters as well as which rule should be applied:

Process Type: The name of the Process or rule to be used
OutputField: The name of the Virtual Merge Field that the processed information will be entered into. This name must be unique for any other OutputField in the XML list and may not be similar to any existing Merge Field in the data source.
ProcessInfo: The parameters of the Process Type is defined here. Each Process Type has a special format for this tag. Many processes have additional Process-paramters as listed below.

Each process or rule is computed and the data is being manipulated according to the rule before the next process is reached in the XML file. Thus, it is possible to manipulate a price and enter the manipulated price in a new Merge Field using one Process Type and in the next rule, use the newly manipulated price as an input for another Process.

Example of a Data Styling file
Following is an example of a short XML Data Styling file. The three rules simply multiply a Price Merge Field with 1.25 (equivalent of the Danish VAT) and then formats the newly calculated price, adding a mask and writing the decimals with the Superscript format, levitating the decimals within InDesign.


1. Process: Here, a mask is applied to the Price Merge Field, removing any delimiters thus making the number ready for a calculation. The cleaned Price is then entered into the Virtual Merge Field PriceCleaned.
2. Process: The PriceCleaned Merge Field is then multiplied by 1.25 using the Calc Process Type and the calculated result is entered into a second Virtual Merge Field: PriceVat.
3. Process: Lastly, PriceVat is again formatted using the Exfm Process Type and the result is entered into the 3rd Virtual Merge Field, NewPrice, which is ready for use in an Item Design.

The Process Types
A total of 15 Process Types are availble for data manipulation. The following list describes each type and gives the format of the ProcessInfo tag. Some of the Process Types use additional paramters. These are described as well.

Used to do simply caculations between data fields. Available opperands are: +, -, * and / for Addition, Subtraction, Multiplication and Division of numbers.
ProcessInfo: simply enter the calculation like [Price]*[VAT]*0.5+[BasePrice]

Used to get the first X characters of a Merge Field counting from the left.
ProcessInfo: [MergeField]
StringLength: X

Used to get the first X characters of a Merge Field counting from the right.
ProcessInfo: [MergeField]
StringLength: X

Used to get a part of a Merge Field starting from character X and counting Y characters.
ProcessInfo: [MergeField]
StringStartPosition: X
StringEndPosition: Y

Used to count how many characters there exist in a Merge Field.
ProcessInfo: [MergeField]

Used to count how many line breaks (<br>) there exist in a Merge Field.
ProcessInfo: [MergeField]

Used to count how many line breaks (<tb>) there exist in a Merge Field.
ProcessInfo: [MergeField]

Used to search for a text string and replace it with another text string.
ProcessInfo: [MergeField]
StringSearch: Text to Search
StringReplace: Text to Replace with

Used to get the first or second part of a text string separated by a character or text string.
ProcessInfo: [MergeField]
StringSplitter: Character or text by which the string is split up
StringPart: Get the first or second part of the splitted string (should be entered as 0 or 1)
StringItemNumber: Split the string by the Nth occurence of the StringSplitter character(s)

Used to get a specific part of a text string separated by a character or text string.
ProcessInfo: [MergeField]
StringSplitter: Character or text by which the string is split up
StringItemNumber: Return the Nth part as seperated by the StringSplitter character(s)

Used to count the number of occurences of a specific string or character.
ProcessInfo: [MergeField]
StringSplitter: Character or string to count

Used to join two or more strings together.
ProcessInfo: [MergeField1][MergeField2][MergeField3]...

Used to launch a JavaScript, AppleScript or VB Script to manipulate the data. The data in ProcessInfo is passed to the Script and the computed result is written back into the OutputField part of the process.
ProcessInfo: [MergeField]
ScriptFile: The name (or name and path) of the script to be used. If a Script Path is specified in the Project Settings, the script must be placed within this.

Used to apply a number mask using the EXFM function.
ProcessInfo: The exact EXFM code as defined in the Special Characters and Options chapter

Used to compare two strings or digits using the EXIF function. Valid opperands are: == (equal to), != (different from), < (less than), > (greater than), <= (less than or equal to) and >= (greater than or equal to).
ProcessInfo: The exact EXIF code as defined in the Special Characters and Options chapter

The GlobalReplace is used for search through all you data, not just a field, but all of it and replace it with the replacement data. The GlobalReplace is intended for uses where a the search must be global. Both the ProcessInfo, and the Output field is not used, because the data itself is both.


Using Data Styling as Text Styling
With the advanced Data Styling tools available it's possible to style your text more efficiently than with the normal Text Styling method as outlined in the Stylistic Text Encoding chapter.
Using the Replace Process will allow you to style text within a data column in stead of forcing the styling to apply to all data columns at once, thus giving you more control over what is styled and what remains unchanged in your data.

Leave a Reply

The Number One Plugin developer for Adobe InDesign