I090 – Publication template

What you will learn ?

How to create a specific publication template

STEP 1: Create a template

A publication template is a data export in a standard format (ex. HTML, XML …).
It is generally used to make simple printing. It can also be used to publish data for integration (ex. User VCARD, XMI model for object diagram).
It is possible to define publications based on template, code, or on file. In all the cases, the principles of fusion between data and model are the same.
The first step is to define a specific HTML template to present the data:

  • Go to the template via the Interface / Template menu
  • Create a new template

STEP 2: Template configuration

Create new template which contains merge fields:

  • [VALUE:<field>]: data value of the current object
  • [BEGIN:<linked object>:<reference field>]
  • [END:<linked object>]
    Sections BEGIN / END can be nested, contain filters and used to navigate through a tree of objects in relation 0, n with higher item.

Exercise:

Create a template AppEditionClient to display customer data, address, and interests. One possible template is:

<H1> [cliCode]:[cliNom]</h1>
<ul>
<li> Type: [cliType]</li>
<li> Qualification: [cliQualif]</li>
<li> Current Score: [cliScore]</li>
<li> Maximum Score: [cliScoreMax] </li>
</ul>
<H2> Address </h2>
<P>
[cliAdresseFK.adrRue] <br/>
[cliAdresseFK.adrCP][cliAdresseFK.adrVille]<br/>
</P>
<H2> Interests </h2>
<ul>
[BEGIN:AppClientInteret:cintClientFK]
<li>[cintInteretFK.intLibelle]</li>
[END:AppClientInteret]
</ul>

Remarks:

  • A field is defined by []
  • For the address, the fields are defined by <referenced name>.<field name>.
    example: [cliAdresseFK.adrRue] is the street from the main address of the customer from the definition of the object AppClient
  • The section between BEGIN / END will loop through all the customer’s interests, each interest will be displayed with bullet point <li>.

STEP 3: Create a publication template

All templates are listed in Interface / publication template. It is therefore possible to create from this list or from Publication template tab of previously defined template.
Click the Create button from the list of templates and enter:

  • The business object code
  • a Publication template code
  • Usage: on object only, on list only, For mailings (loop on a list by applying the model to each line)
  • Type = Template to link it to a defined template, file to attach an attachment, or method in the object
  • Forced MIME Type: used to force an output format (HTML)
  • Language + Translation: it is necessary to define as many templates as languages because the template may contain texts to translate
  • Grantable: if set to yes, it will link the publication template to groups of rights defined in the Print template grant tab, otherwise the publication template is available for users with read access to the business object
  • Module

Exercise:

Create the publication template AppClient-PT

  • Based on the template AppCustomerPubTemp
  • = Use the object only (on his entry form)
  • Type = Template
  • ForecMIME type = HTML
  • Translation = Edition
  • Module = MyModule
    Save.

STEP 4: Result

Clear all caches and open an object, the Printer icon should appear on the form.

Exercise:

  • Open a customer with address and interests to see the result
  • When all the fields are set correctly, improve the template by adding color, charts, pictures, etc.

I080 – Object template

Create a template for a business object..

I100 – Modules (import, export, diff)

How to import an existing module to a new instance.