Report templates

You can create forms and reports with a visual interface or using advanced tools like GraphQL queries, HTML code, and CSS.

Create a custom form or report template

This method uses a visual interface and does not require advanced knowledge of HTML or other tools. If you're creating a report with line data like sales or purchase order lines, see the following section on grouping data.

You can duplicate any report template and then customize following the steps below. The only requirement is to give the duplicate a unique name. You also have the option to link the duplicated template to a different report.

See Working with templates for additional information such as printing, generating, and examples.

This example creates a custom purchase order template based on the purchaseOrder report or a custom version of this report.

  1. Select Create.
  2. This opens to the Basic details tab where you begin by entering a unique name for your template. The name cannot have spaces or special characters.
  3. Select a Report from the dropdown menu. You can select purchaseOrder to use the factory report delivered by Sage. The report includes a variable that is applied to the template. In this case, it's for the order number and it plays an important role when you start adding data later on.

    If you created a new report, you can select _MyCustomerPurchaseOrder.

  4. For Definition locale, select the primary language for your template. This selection also affects currency and date formats.
See the section on the Translation tab if you are adapting a factory template to your language.
  1. Settings in the Page format block are optional at this point. You can accept the defaults or make changes here. You can also make changes while working on your report.
  2. You can proceed to the Template tab without saving, but it's best to save as you progress.
  3. Place your cursor in the header area. In the toolbar, select the Show/Hide document properties panel icon.
  4. On the right, you see a list of Document properties. Select Total number of pages. This field is added to the report template header.
  5. Keeping the focus on this new field, select Align right from the Editing toolbar.
Convert to HTML is described below. This option creates an advanced version of the current report, which requires advanced knowledge of GraphQL when you select an entity, record node, and so on; HTML code; and CSS.

Add data

On the Template tab you can select, filter, and sort the data for your report. Refer to layout options in the guide for tips on design options.

Let's continue with the purchase order report template.

If you don't see the Preview panel, just select Preview to open it. If the button is not visible, you need to save recent changes.
  1. Select the folder symbol to display the Fields panel. This panel displays the data you can add to your template including any Custom fields that you created. It's based on the Parent package for the report.
  2. You're going add the data container for your report. Start by filtering data for your report. In the search box, enter purchase order.
  3. Select Purchase order to add the data container. The Insert an object type wizard opens. Select Data container.
  4. Remember that this report has a variable associated with it. You need to reflect that on the Define filters panel.
This step is critical to create a report that references a specific purchase order number.
  1. Add a filter with these values:
    Property is _id.
    Filter type is Equals.
    Use parameter switch to ON.
    Filter value is Purchase order.
    When you enter a purchase order number for your report, this ensures that all related data is pulled for the order.
  2. After adding this filter, the Purchase order field displays on the Variables tab in the Preview panel. You also see the Print block variable, that we'll use in a later step, if you created the custom report.
    Zoom in to the Variables tab of the Preview panel to show the checkbox and order selection field
  3. Before adding more data, let's add a title and the purchase order number and date.
  4. At the top of the data container, type Purchase order: and format the text however you like.
  5. With your cursor just after the colon, select Number and Order date from the Fields panel.
  6. Now let's add a simple, 2-column, 2-row table to the data container from the Editing toolbar.
  7. In the first row, let's add some text using the toolbar. Use the standard editing tools to select a font, color, and alignment. For example:
    Two-column, two-row table for the addresses
  8. In the first column, second row, we're going to add the supplier information. Place your cursor in the first column, and in the Fields panel, scroll down to and expand Supplier address.
  9. Select each field to add them to that first column:
    Name, Address line 1, Address line 2, City, Postal code, Region.
    You can drag and drop Name to move it up, add a return after each line, and change the alignment if you wish.
  10. Now let's add data to the second column. In the Fields column, scroll down to and expand Site address. Add the same fields as you did above.
  11. To check our status, let's add or select an order number. Remember, you're adding dynamic fields. Actual data does not display unless you add the order, which satisfies the variable requirement.
  12. Select Preview to open the Preview panel if necessary. On the Variables tab, you see the Order field. If you're using the _MyPurchase Order report, you'll see Purchase order and the Do not print checkbox you added as a second variable.
  13. In the Order field, enter or select an order number. The preview updates after a few seconds to display data for that order. In the sample image below, only the vendor address has 2 address lines. The ship to address line 2 is empty. This looks like something is missing or just bad formatting.Two address and the second address has an empty line after the street number
  14. To fix this, we can apply a condition to the Address line 2 fields so that they only display if they contain data.
  1. Remove the vendor Address line 2 data field and keep your cursor in the same place to add a conditional block here. On the Editing toolbar, select the Conditional block icon.
  2. In the Conditional block window, select Add condition.
  1. Apply these settings for the following columns:
    Value Type 1 = Property
    Value 1 = select the Supplier > Address line 2 from the list.
    Operator = Not empty
  2. Select Apply to close the window and add this condition.
  3. Repeat this process for the second Address line 2 data field under Ship to.
  4. Save and add a purchase order number to the variable field.
  5. The addresses display the needed data without the empty line. The vendor address includes the Address line 2 because it contains data: ZI. The ship to address does not display the second line because it does not contain data.

Two address and the second address no longer displays an empty line.

If apply the same condition to Region for both addresses, you can remove the space above the Ship to address.
Let's get back to creating a custom purchase order. You can close the preview panel for now.
  1. Place your cursor below the Vendor and Ship to table, and add a 2-row, 4-column table.
  2. In the first row, add these column headings using the toolbar: Delivery mode, Payment term, Late charge type, and Late charge amount.
  3. In the row below, add the related data fields.
    Hint: Late charge type and Late charge amount are called Penalty type and Penalty amount and are nested under Payment term.
If you're using the _MyPurchaseOrder report, continue here. Otherwise skip to step 37.
  1. We're going to apply a different type of condition to this data using the Print block variable we created with the custom report.
  2. Place your cursor in the space above the 4-column table.
  3. From the Editing toolbar, select Conditional block and add the following condition, then Apply:
    Value Type 1 is Parameter.
    Value 1 is Print block.
    Operator defaults to Equals.
    Value Type 2 is Constant.
    Value 2 is True.
  4. From the Fields panel, add the Earliest expected date data field to the conditional block you just created.
  5. Place your cursor to the left of this field and enter: Earliest expected date.
  6. Highlight this text and the data field and apply a different font color to make this information stand out.
  7. Add a purchase order number. In the preview, the earliest expected date does not display.
  8. Select the Print block checkbox and wait a few seconds for the display to update. The date now displays.
You can add as many conditional blocks that use this variable as you need. Remember that they are all governed by the same checkbox. Of course, you can go back to your custom report and add more variables that in turn add more checkboxes.

  1. To add purchase order lines, place your cursor below the table with delivery information enter a heading for the next section: Order lines.
  2. In the Fields panel, search for and select Lines. The Insert an object type wizard opens.
  3. Select Table.
  4. Select the columns you want to include. If you open a purchase order in another window, you can see which fields you want to include, such as item name, invoiced quantity, gross and net prices, line amount including and excluding tax
  5. Next, you can sort the order and group, following the instructions in the next section. See Group data and add totals for an example.
When you're done, the table includes the line information and column headers. You can add formatting and edit the text in the headers as needed. See Layout and design options.

Group data and add totals

If you're creating a report with line data like sales or purchase order lines, you can group table data that features key metrics like minimum, maximum, sum, average, and count. To do this, you need to add data as a table, step 2 above.

You can only group data while creating your form template. You cannot change groups after you exit the wizard.

When you get to the third panel, Define content, in the wizard, you can begin to group your data and select an operator like sum, average, distinct count, and so on, for lines.

The image below shows an example of how you can group data and add metrics.

Important points

The Title column displays a custom name that is different from the property name.

Groups display in numerical order. You can have more than 1 property per group.

The Document number operation can only be Distinct count.

Sums and averages are labeled Group 1 footer, Group 2 footer, and so on, in the visual editor.

The last group simply displays Footer.

Screenshot showing how to group data in the insert object wizard

You cannot modify groups after you exit the wizard. To regroup data or change totals, you need to add a new data container.

Add a condition

After adding data, you can decide if certain information is included or excluded when printing a report based on conditions that you define. For example, this could be useful when sending a report outside your organization and you need to exclude sensitive data from a report.

This is explained above in the section Add data.

See Conditions and variables for more information.

Layout and design options

This section describes the various layout and design options you can use when building a custom form or report. You can do this on the Template tab.

Collapse the left panel to expand the design area.

Basic formatting options

Start by displaying the Formatting panel from the toolbar, which displays options and settings related to elements in the template.

Highlight an element like a table or data container to see your options.

If you added a table for data, the Formatting panel displays for alignment, background and border colors, styles, and you can modify columns.

If you added a data container, use the Formatting panel to modify sorting and filters.

If you did not define a locale or a paper format, you can do this on the Settings tab in the Preview panel. The paper format refers to standard paper sizes and affects how your template displays and prints.

Editing toolbar

The Editing toolbar is part of the rich text editor and provides standard options for text and other elements in your template. For example, you can insert an image, like a company logo, using the Insert image button. You can change fonts, insert a table, and so on.

From the toolbar, you can also insert:

Document properties

When you select this option, you can insert dynamic content such as the current date, who generated the report, and so on.

If your cursor is in the header or footer section, you can insert the page number and the total number of pages.

Unbreakable container

When you insert an unbreakable container, the data within the container displays on the same page. For example, if you had the container toward the lower part of the page, the container would begin at the top of the next page if the contents don't fit the current page.

Conditional block

To include or not a data field or block based on variables and filters.

Headers and footers

You can enter content for headers and footers directly in the design area. Remember that the content you enter displays on all pages.

In addition, you can insert document properties like page number and total number of pages, as described above.

If your header or footer content overlaps with the main report content, go back to the Basic details tab to increase the size.

Move or remove elements

Elements can be moved within their original blocks. You cannot move a data field from one data container to another or from a table to a data container.

Select an element. This changes to border color from yellow to blue. You can drag it to a new location, add a carriage return, or delete it.

Header and footer tab

This tab only displays when you build an advanced, HTML template.

You can enter a header and/or a footer that displays on every page of your template. Select Preview to update the Preview panel to see your text.

For list reports, you have to option to use default headers and footers.

Attachment tab

The content for this topic is still in progress.

We will make the content available as soon as we can. Your patience is appreciated.

Translation tab

If you need to use your custom template in another language, you can enter the translated text for plain text you entered in your template.

Translate a factory report delivered in English

Though not required, you can also create a copy of the factory report the template is associated with. This allows you to recreate variables and conditions in your language. See Create a report for instructions. It is the same whether creating or copy a report.

Duplicate a report template

  1. On the Report templates page, from the main list, select the factory template you want to adapt to your language.
  2. At the top of the page, select the Duplicate icon.
  3. Give your report template a unique name. Keep the same setting for Report and select your Definition locale. Change the page format if desired.
Data labels are not included here.

The Translation grid displays one line for each line of plain text you added to your template.

  1. In the Target column, select English (US).
  2. The Source column displays all text in English (US) in the report. If you select multiple source languages, the Source column displays relevant text.
  3. In the Target column, enter the text you want in your language to replace the English (US) in the report.
  4. Save your changes.
  5. To see the translated text in your template, in the Preview panel, change Preview locale on the Settings tab to the desired language.

Advanced report: Convert to HTML

When you select Convert to HTML, you have 2 options:

Create HTML copy of your template. You can continue editing in the visual interface and you can work directly in the HTML code version of your template. This option gives you 2 versions of the same template.

Changes made in one version do not automatically apply to the other.

Convert takes you out of the graphic interface. You can only work on your template using advanced tools like data queries, HTML code, CSS, and so on.

This cannot be undone.
  1. After creating a template, such as myPackingSlip, select Convert to HTML.
  2. Select the option to Create HTML copy.
  3. You are back to the Basic details tab, with a different set of tabs.
  4. The name would be myPackingSlip1, but the rest of the field values default from the original template.
  5. On the Data query tab, you can see queries in GraphQL to add data.
  6. On the Code tab, you can add code to sort, filter, or add conditions to your data.
  7. Use the HTML template tab to modify the layout using standard HTML code.
  8. You can update and customize further on the Style sheet tab using standard CSS code.

Working with templates

This section answers basic questions and provides step-by-step examples.

How do I generate and print a form or report?

You can generate a report from the Reports page or from the Report template. You can access the finished report from the Notification center.

  1. From the Reports page, select the report your template is associated with.

  2. On the Templates tab, select the printer icon to open the Generate report window.

  3. If this report includes variables such as a purchase order number or packing slip number, you need to enter or select that number to reference the correct data.

  4. Also, if there is a conditional block, select the related checkbox if needed.

  5. Select Generate.

The second method:

  1. Open the report template from the Report templates page or by selecting the Edit icon on the Reports page.

  2. If needed, you can make any modifications.

  3. If this report includes variables such as a purchase order number or packing slip number, you need to enter or select that number to reference the correct data.

  4. Also, if there is a conditional block, select the related checkbox if needed.

  1. If you want to view the document first, select Extend preview and then select Print. This opens a print dialog box where you can select from standard print options.

When you close the template, you always go back to the Reports page, even if you opened the template from the Report templates page.

What do the different icons mean in the Fields panel?

Different icons for data listed in the Fields panel signal type of data. It's important to understand their meanings when adding data to your template.

Icons for data types

  • The Plus sign icon means you can expand that group to see more data. It is a reference that can be used to filter for data. You cannot add this type of data. You need to expand until you see one of the types below.

  • The Lines icon means this is a collection of data. Use this data type to include lines for purchase orders, sales orders, invoices, and so on.

    You can only add this data if your cursor is already in a data container. When you select a collection, you need to decide whether to add it as a nested table or another container.

    When you add lines data, the data available in the Fields panel updates to reflect your selection.

  • The Block icon represents a single property. If your cursor is not already in a data container or table, you need to decide whether to add this property as a table or data container. If you want to include this property to an existing table or data container, selecting this property adds it to where your cursor is located.

What do I do if I can't see the preview?

There could be a few reasons that are easy to resolve.

Data: If there is no data for the report the preview is empty. For example, if you selected a date or amount range, there could be no data that matches those settings. Additionally, if your report requires that you enter a customer or sales number, nothing displays until you enter the required data on the Variables tab in the Preview panel.

Edits: If you are creating a new report template or make a lot of modifications, the Preview button might not display. Save your work and the select Preview.

Why are factory templates in English even though I'm connected in another language like German or French?

Report templates delivered with factory reports are only provided in English. You need to create a copy of the report template and enter translations. See Translate a factory report delivered in English.

How can I replace the standard form in the print options on a document record?

First, create a new form, such as a packing slip described above. Using that as an example:

  1. On the Report page, select packingSlip from the main list.

  2. In the packingSlip record, in the Active template field, select your custom form from the list.

  3. Save and go to the Sales shipment page.

  4. Open a sales shipment record, select Print.

  5. You see your new template applied to the packing slip document.

Why can't I use spaces in my template name?

Template names use a naming convention called camelCase, where you can use upper or lowercase words but no spaces or special characters. If you decide to apply APIs to any of your templates, the name in this format is already compliant with the necessary syntax.