Velocity library

Lookup Columns

Lookup columns
can be used in document automation templates, advanced search and view filters. This section explains how to create an iSheet with a lookup column.
Allow lookups
Allow lookups
must be enabled for each iSheet that is used as a lookup source. Open
Admin
, select
iSheets
and then select an iSheet from the list.
Create a Lookup column
Create a Lookup column in an iSheet. Navigate to the
Admin
>
iSheets
section and select
Add
to add a new iSheet.
Once the iSheet has been created the lookup column needs to be added into the iSheet. Use the
More actions
option and choose
Manage columns
.
Select
Add column
and the
Add Column
window displays. Enter a column name. The column type should be set to
Lookup
.
In the
Sheet (Site)
field ensure you have selected the iSheet and columns that you want to take data from. Make a note of the view type as this information will be needed for the document template. Select
Save
.
This article provides examples of Velocity code that you can use with Document Automation ('Doc Auto') templates.

Doc Auto template syntax

To create the template needed for Document Automation, open the template in Microsoft Word. You should already have syntax similar to the image below.
To edit the fields go to the left of each line and right-click, as shown in the image below. Choose
Edit Field
.
The
Field
window displays.
The field name needs to be updated to reflect the information that needs to be added.
You need to enter the characters exactly as displayed, with the same casing.
Each section of information should be added in between the two apostrophes e.g. 'comments I have added'. For example:
#set($sheetTitle='
Enter your sheet title here
')
#set($viewName='
Enter the view here e.g. Default
')
#set($map={"c1":"
Enter the lookup column name here||enter the name of the first column you want to lookup here
"})
$!{map.put("c2","
Enter the lookup column name here||enter the name of the second column you want to lookup here
")}
$!{map.put("c3","
Enter the lookup column name here||enter the name of the third column you want to lookup here
")}
#set($fieldsMap=$utils.getSheetDocReportDataMap( $sheetTitle,$viewName,$map))
#foreach($key in $fieldsMap.keySet())
#set($innerMap=$fieldsMap.get($key))
#foreach($innerKey in $innerMap.keySet())
$innerMap.get($innerKey)
#end
#end
Once you have added the required information it should look like this:
The highlighted areas in the example above should contain your own references.
The
||
(double pipe sign) indicates a
lookup column
(the two examples, 'c1' and 'c2' in the image above). The 'c3' line in the example above references a single-line text column, so does not need to include a
||
. In this example, the lookup columns are from another iSheet, selected when you created the lookup column in the iSheet.
To remove a line from the syntax (for instance, a column because it's not needed) just highlight the line and delete it.
To add a line into the syntax, copy a line already in the syntax, click at the end of the row above where you want to add the line and tap enter. Select
Insert
, click on the
Quick Parts
icon (1),
Field
(2), and then
Insert Field
(3). Paste the copied line and change
c1
to the next column number, depending on how many are in the list e.g. 2, 3. Select
OK
to save the update.
Save your document.

Manage document templates

Navigate to
Admin
>
iSheets
to see the main iSheets view. Select
Manage document templates
to add a Word file as a document template.
Click
Add template
, then enter a template name, choose the radio options for
Site wide template
or
Single record template
and then
Browse
to add the Word document. In the
Document automation
settings of the
Add template
window, you can choose how your document is generated and choose settings for saving and downloading the file. Select
Save
to add your template to the
Manage document templates
listing.
To use the lookup template you will need to access the iSheet and use the
Doc Auto
(or
Generate document
) option. Go to
iSheets
from the site navigation bar and then select your iSheet from the listing.
In the
More actions
option choose
Doc Auto
(renamed
Generate document
on some instances).
The
Document templates
window displays. Select the template that includes the lookup column and select
Generate
. The document is displayed as defined in settings (either Word or PDF) and includes the lookup columns requested in the
Edit Column
window.

Related content