Command Reference CIB jsMerge

Syntax Basics

Using Fields

Allgemein
Script Fields
Content Fields

Allgemein

Fields are defined elements required for text programming in dynamic documents. During a merge run, CIB jsMerge interprets the fields used within a document and outputs them dynamically to the output file.

The fields used in this context are similar to MS-Word fields, but not identical. We distinguish between two types of fields, script fields and content fields. Their specific structure and usage are described in more detail in the following chapters.

A field is a special component within a document and has the following structure:

{ content }

 

Fields are parenthesized with these field markers: { } . Note that opening and closing bracket define the field and one cannot stand without the other, i.e. if you delete one, you delete the field.

Important:

Fields can only be added via the corresponding text editor commands.
Fields can only be added via the corresponding text editor commands. In MS-Word, this is CTRL-F9, in LibreOffice via the CIB officeControlBlocks plug-in button. Manually inserted curly brackets will not be interpreted as field markers.


Script Fields

Script fields contain one or several instructions of a script as well as additional meta data. Script fields always start with a hash character “#” and are structured like this:

 {#ScriptContent }

The “scriptContent” is interpreted by the script interpreter. This “scriptContent” can also be one or more nested fields.

Examples:

{# text(ref(“firstname”)) }
{# if(ref(“firstname”)!=””) text(ref(“firstname”)) }


Content Fields

Content fields are used to mark text content inside a script field as non-interpretable text content. This enables us to mix script and normal text content and let the script control which fields are written to the resulting document and which are not. Content fields have the following structure:

 {NonInterpretableTextContent }

or

 {NonInterpretableTextContent} (possible only in ODT)

“NonInterpretableTextContent” can be any text content that is supported by the text editor, i.e. in all formats (e.g. Rich Text) and formatting options (e.g. tables).

Attention:

The content field must not start with hash character “#” or it will be interpreted as a script field. In order to be able to start the text content with a hash character, we introduced the apostrophe (‘) as an escape character. After the apostrophe, any text content may follow (even the apostrophe).

Example:

{#1 } will be interpreted as a script field
{#1 } the hash character is escaped correctly

MoreExamples for content fields:

{This is the textcontent of this content field}
{The content can also contain a table:

Table inside the content field

and much more }
only in ODT templates the following content field works also: { content field without apostrophe}


Note about MS Word:

In MS Word one might want to use legacy MS Word fields like { DATE }. A legacy MS Word field is not interpreted by CIB jsMerge in any way. To distinguish content fields and legacy MS Word fields, CIB jsMerge only recognizes a content field if it is escaped with an apostrophe (‘).

Examples:

{ DATE }

Will not be processed by CIB jsMerge

{my content }

This is a content field. That writes the string “my content” to the resulting document.

{DATE }

This is also a content field that writes the string „DATE“ into the resulting document.