Example of Report Template Creation

Previous pageReturn to chapter overviewNext page

Report template is a GRB file, which describes report format and data in file according to the certain rules. You need to create a table in the report template file using TE: Create Text format. Structure of the report is described in its cells.

Creation of report template:

1.Create a new document based on “ISO Drawing” template and save it into the folder with templates. Path to report templates is set in SO: Set System Options command on the Folder tab.

2.Set A4 format and portrait orientation on the Paper tab in the ST: Set Document Parameters command.

3.If the template will be used for creation of reports on a separate page or in another document, insert the 2D fragment of a title block, which contains a table header and lines.

4.If the template will be used for creation of reports on the current page, you can skip this step.

5.Create a paragraph text using command TE: Create Text. Attach it to the nodes of the title block fragment or in absolute coordinates.

clip2125

Press clip2126 after selection of attaching points. After that, you need to specify coordinates for new text rectangles using Change paragraph size parameters clip2127 option from automenu. Records, which don’t fit on the first page, will be moved to new rectangles.

 

If the template is for the current page, select “Create rectangle on current page”. Note that its position should not coincide with the coordinates of the existing rectangle.

clip2128

 

If the template is for a new page select “Create New Page with Rectangle”. Its coordinates should coincide with the nodes on the following BOM or report pages.

You should set rectangle coordinates manually in the Rectangle Coordinates section.

Press [OK] button.

 

6.Add a table header into the created paragraph text.

7.If the template is for a separate page, you can skip this step.

Header should be between {summary} and {/summary} tags. You should create a table with column names there. The table is filled in manually.

clip2129

8.Add tags {group} and {/group} for group of records output.

clip2130

9.Create a table for a group header. Name of the BOM section is a header of the group in standard BOM.

 

Note! Total width of all tables should match with the first table.

 

Add {Section/} tag to a column. It will display name of the section, which is used for grouping records in the report.

clip2131

10.If a group header has no text (for example, if it is a group of records without section), the table will be empty and should not be displayed in the report. You need to add a condition. First, you need to find name of the corresponding group in the product structure. Its name is “No group”.

clip2132

You need to add the filter {group hide_table="Group_name = 'No group'"} which will replace the opening tag of the group.

clip2133

11.Add table for new BOM records. Add {list} and {/list} tags.

clip2134

12.In the third table, you should specify names of product structure columns. Data from the columns will be added to the report.

13.If there are no spaces in the column name, you should type {column_name/}. You can use a synonym name instead of the name of the column.

clip2135

If there is a space in the column name, use the following record:

{param name="Column name"/}

Example of filling of the third table cells, which do not have additional filters:

clip2136

You can manage value output using filter. For example, the following filter allows you to display only the non-null field values in the column:

{Quantity filter="Quantity != 0"/}

clip2137

Creation of the simplest report template is finished. Finish paragraph text edition using clip2138 and save your document.

 

Note! Text of report template should fit paragraph text rectangle. It should not go beyond it by height or width.

 

Report template should be used for a report generator.

Report generator properties are described in “Reports” section of “Product structure types” chapter.

If a new report generator is created for a product structure type, not for a product structure in the document, it can be used in all documents where the product structure type is used.

clip2139

It will be necessary to update product structure properties for the existing documents according to the properties of the updated product structure type.

Additional Features

Add a summation result to the report.

For example, if you need to display total weight use {outcome name="Weight" out_operation="numeric_sum"/} record in a separate table between {summary} and {/summary} tags.

clip2140

 

Formatting of the value in the column may be performed using argument parameter.

For example, the following record will display the summation result with accuracy of two decimal places:

{outcome name="Weight" out_operation="numeric_sum" argument="F2"/}

 

You can display variable value in a report using variable name element.

For example, {variable name="$Date"/}.

The variable should exist in the file based on which the report is created.

 

You can display records of all levels for the representation using recursive attribute.

{list recursive="true"}

You can find description of elements and attributes for report template in “Report/BOM template” section.

 

You can add macros. Additional data processing can be performed using a macro, which may be added to the report template file. You can add and edit a macro in the Macro editor.

clip2141

A macro can process product structure records or data, which is displayed in a table cell.

In the first case a macro is called using {group_macro name="Name "/}. Name is a name of the macro, which should be run before the table is filled in.

You can use filter attribute, when you call a macro. The macro will be applied only for groups that correspond the condition.

Example: {group_macro name="Gen.Gen.GroupMacro" filter="Section = 'Industry Standard Parts '"/}

The macro for processing of textual value in the table cell is used in param and outcome elements. The macro is called using {param name="Column name" str_proc_macro="Name"/}. Name is a name of the macro for string processing.

Example: {param name="Quantity$$00" str_proc_macro="Gen.Gen.XAmount"/}