Help Centre

Choose a category to find the help you need

Printing and generating documents

In the tiles interface, there’s a per-tile option to show a print button. To enable this open the tile, move the mouse to the top right of the screen and click the cog icon to open the tile settings.

 

Tile settings

 

Select the ‘always show a print button’ option and click ‘update tile options’. The next time you open the tile, an easy to see print button will be available on the left of the screen.

When print is pressed a print preview will open. There are two printout types that can be selected from the top of the screen

  • individual record: this prints out the detail for the current record, as shown in the editing screen
  • all report rows: this prints out a list view of data as shown in the view, with any current filters applied

At the top right of the preview screen, there’s also the option to manage printout templates. This gives you the ability to add custom printout templates, for example if you want to generate branded quotes, invoices or other documents.

A custom template must be created in the HTML language, with templating commands that are described in our separate templating documentation. If you have these skills in-house and are interested in this, please get in touch.

Custom templates

Custom templates in agileBase are typically used to create output that needs to be printed or emailed, for example form letters and especially anything that needs to be branded. They can be used for some quite complex and large documents, for example one customer uses them to create branded multi-page reports that are sold to customers, complete with custom fonts, layouts, images and colours.

We’ll just cover the basics here, if you have more advanced needs please get in touch and we’ll be happy to help you get going.

 

The concepts

Each template is a HTML file that includes variables output from agileBase. The variables come from the current view and table selected by the user, or alternatively from specific sources defined in the template. So for example a user could select a contact, then press ‘print’ and choose from a selection of documents to merge data into.

Note that calculations from a view as well as standard fields can be included in templates.

One or more templates can be uploaded per view. In the administration interface, select a view, then press the print button in the toolbar. The two default print options will appear, i.e. the option to print the currently selected record or a list of all filtered records in the view.

Ignore these and press the ‘manage’ button at the top right. This will let you upload one or more templates into the view.

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Letter example</title>
</head>

<body>
<br />
<br />
<br />
<br />
<br />
<br />
$salutation $surname <br /> 
$mailing_house_name <br />
$mailing_no_and_street<br /> 
$mailing_town <br /> 
$mailing_city<br />
$mailing_county<br />
$mailing_postcode<br />
<br />

Our Ref: $lead_number<br />
<br />
$viewTools.getDatestampString()<br />
 
<p>Dear $salutation $surname</p>

<p>APPOINTMENT: $sales_appointment</p>

<p>I write to thank you for your valued enquiry. etc. etc.</p> 
<p> Yours sincerely</p>
<br />
<br />
<p>Oliver Kohll</p>
<p>Sales and Marketing Co-odrinator</p>
</body>
</html>

 

Example 1: a letter

This template will merge data from the current record in. Note that field names have dollar signs below them. They match the field names in agileBase except

  1. they are all lower case
  2. spaces are replaced by underscores (_)
  3. all characters that are neither letters nor numbers are removed

 

Example 2

Similar to example 1, this template prints the same letter, but one copy for each row in the current view.

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Letter example</title>
</head>
<body>
#set($rows = $view.getReportDataRows())
#foreach($row in $rows)
  #set($salutation = $row.getValue("salutation"))
  #set($surname = $row.getValue("surname"))
  #set($mailing_house_name = $row.getValue("mailing house name"))
  #set($mailing_no_and_street = $row.getValue("mailing no and street"))
  #set($mailing_city = $row.getValue("mailing city"))
  #set($mailing_county = $row.getValue("mailing county"))
  #set($mailing_postcode = $row.getValue("mailing postcode"))
  #set($lead_number = $row.getValue("lead number"))
  <br style="page-break-before: always;" />
  <br />
  <br />
  <br />
  <br />
  <br />
  <br />
  $salutation $surname <br /> 
  $mailing_house_name <br />
  $mailing_no_and_street<br /> 
  $mailing_town <br /> 
  $mailing_city<br />
  $mailing_county<br />
  $mailing_postcode<br />
  <br />
  Our Ref: $lead_number<br />
  <br />
  $viewTools.getDatestampString()<br />
 
  <p>Dear $salutation $surname</p>
  <p>APPOINTMENT: $sales_appointment</p>
  <p>I write to thank you for your valued enquiry. etc. etc.</p> 
  <p> Yours sincerely</p>
  <br />
  <br />
  <p>Oliver Kohll</p>
  <p>Sales and Marketing Co-odrinator</p>
#end ## End of foreach loop around rows
</body>
</html>

 

Advanced needs

A number of other capabilities exist within templates, powered by our extensive templating API, which uses the Apache Velocity language. Data from any agileBase view can be filtered and queried and a number of formatting tools are included, for example to turn numbers (1,200) into words (“one thousand, two hundred”). The full Java API can be used on any String objects.

For further information, please get in touch.

WYSIWYG document template editing

A lot of recent agileBase updates have addressed document generation – how to merge data from the system into a template to create a PDF document, how to automate document generation based on criteria, how to get the system to email documents automatically.

So how do you create the templates that all this functionality uses?

Up until now, that meant a template designer with some knowledge of HTML (the language of web pages) using a web design tool of choice such as Adobe Dreamweaver of CoffeeCup. Now however, there’s a new built-in ‘what-you-see-is-what-you-get’ design tool built in to the platform, from Froala. Here’s an example template being edited:

 

Template editor

 

To use this, open a tile and click the ‘print’ button (if the print button isn’t visible, go to the tile options by clicking the cog at the top right of the screen and enable it).

Then click the ‘manage’ icon at the top right. Click ‘edit’ next to a previously created template, or type in a new template name to create.

The editor will load, with a toolbar at the top that gives you lots of options, for text formatting (bold, italic etc.), alignment, bullets and numbers, tables, colouring and more. As normal, to merge in data from the database, type the field name preceded by a dollar sign. In fact, there’s now a quick-reference list of available field names below the template editor, so you don’t have to switch back and forth between the editor and the system to look up field names.

There are still a few complex things that the visual editor won’t handle, e.g. pulling in data from multiple different views filtered in different ways. Power users can still use the editor for these by switching to code view, which is the button at the far right of the editing toolbar.

 

Notes

This is the first release of the editing feature, so it’s not as fully comprehensive as it will become. There are some other features that will likely be included in future releases, such as the ability to upload images or integrate some of the more complex templating language features.

Generating documents

For anyone who wants to generate invoices, information sheets, or any other documents from the system, there’s now a new way to do it with just the press of a button.

 

Generate a document

 

It uses exactly the same templating system as for printouts.  So you can take a template created to make a printout and have it generate a PDF document – making document creation a one click process.

This mechanism opens up the possibility of generating documents automatically too, based on user-set criteria, for example to generate an invoice automatically when an annual renewal occurs. This is in fact one of the next developments in the pipeline so watch this space.

 

Setting up document generation

Firstly, create and upload a printout template into a view. You can use the print button to preview the output as you’re working. Make a note of the name of the template.

Then, in agileBase’s administration interface, go to the table (under ‘Build’) that contains the file field that you want to use to generate documents. Alternatively, add a new file field to a table. Click the ‘fields’ tab and next to the file field, click ‘edit options’.

For the ‘template’ option, type the name of the template you uploaded above, without any filename extension.

That’s it. Users will now be able to press ‘generate’ when they go to that view and create or edit a record.

Automated bulk document generation

Following on from last week’s new feature – generating PDF documents with the click of a button, this week’s update removes the need for the button click, generating documents automatically based on criteria you specify.

For example, if your system tracks exam marks, you may wish to automatically generate a certificate whenever someone passes. Another more common example might be generating invoices for all work carried out this month.

 

Setting up

The concept works much like email notifications or syncing events to Google calendar. A view must be set up that contains the records that you want to generate documents for.

  1. The first step is to set up and upload a template as per ‘generating PDF documents
  2. Add a date field to the table that contains the document file field, for the system to record the time each document was generated. For the purposes of these instructions, we’ll assume it’s called ‘document generation time’
  3. Create a new view to contain only records that need documents generating, e.g. with a filter added to remove any records that already have a document
  4. In the manage tab for the view, click the ‘sync’ button and scroll down to ‘automatic document generation’. Select the date field that you created in step 2 above, i.e. ‘document generation time’

That’s it. Now whenever a record appears in the view, a document will be generated. Note this generation may take up to 10 minutes from the time the record appears in the view to allow for the fact if a record’s being edited, we want to make sure all information has been captured that may go into the document template.

 

How to sync

Automatically emailing documents as attachments

Here’s an update which builds on the update from a couple of days ago about automatically generating documents, e.g. invoices, certificates or event brochures/flyers.

email-attachmentOnce your system is generating documents automatically, you can set it up to email those out to people as attachments, also automatically without any user input. That’s great if you’re processing a large number of documents, for example invoicing hundreds or thousands of people per invoice run – it could be quite a time saver.

To set this up, create an automated notification as normal, to send an email to the intended document recipient. Just make sure that the body ‘template’ contains a reference to the field name of the document that you want to attach – the document field must be in the table that the notification view’s based on.

e.g. your template body could be

 

Dear {forename},

Many thanks for your custom with us this month. Your invoice {invoice number} is attached.

Regards
XYZ

{invoice file}

 

Note – we recommend setting it up to send to someone within your organisation as a test, before switching to the actual recipient.


Not found what you’re looking for?

Please email us at support@agilechilli.com