Creating Document Templates
Before creating a digital document in Innovation Studio, you should create a template using MS Word or MS Excel.
- you remove all comments.
- to accept all changes (if any) and stop tracking changes.
- the signature details fit within the page, always center the signature token.
When creating the template, use token fields for the fields and table tokens. The template automatically fills in with data from the DB, as it is going to be attached to a digital document.
The digital document's data source is an SQL procedure or Fetch Collection.
The SQL procedure has to be defined in advance, while the Fetch Collection is defined after attaching the template to the digital document.
Use token fields
A token field is a text field that includes a block of text (token) that can be easily selected and manipulated.
To use token fields within your report template, include them within curly brackets {} without leading or trailing spaces.
The token should have the following format: table.Name.attributeAlias or tableName.attributeName.
The figure below shows an example of a report template.
Use table tokens
In case of a table token, the SQL procedure call must contain two select queries separated by comma:
- The first SELECT should follow this pattern: SELECT 'tokenName' as 'table' to specify that the 'tokenName' token represents a table.
- The second SELECT will return effective data for the table. The document table columns name must be identical to the attributes name returned by query.
Example:
select 'views' as 'table',
select entityviewid as 'entityviewid', Data as 'Data'
from EbsTestEntityView
Format tables in DOCX and XLSX templates
You have various possibilities to format tables in templates: table size, border size, cell padding, add/delete header and border color. You can also include datasets within the table by using table tokens which you handle via SQL procedures or Fetch Collections.
When creating the document template, format the tables as needed.
To automatically fill-in table rows with data from the DB, add a new row to the table and provide the table token in the following format: {tableName.columnAlias}
Show or hide objects in document templates
You can show or hide/remove objects (that is, paragraphs or tables) in the Word/Excel document templates.
To do so, use the following token: {show=var1}
, where var1 is provided in the SQL procedure in the first dataset.
In the SQL procedure, the possible values for var1 are 1 ( show object) and 0 (hide object); whereas, the default value is 1.
If the var1 value is not provided within the first dataset of the procedure, the object will be displayed.
To hide an object, in the SQL procedure set the value of var1 to 0.