The report/BOM template is a specially prepared GRB file that contains data and options for generating reports. The report format and data composition are described in this file according to certain rules.
This file contains table created using the Text command and various composition data in its cells. System installation has various predefined report templates. Path to the report templates folder is specified in the system options dialog (Options > Bill of Materials > Folders > BOM/Report Templates).
Creation of report template:
1.Create a new document based on ISO Drawing prototype and save it into the folder with templates.
2.Set A4 format and portrait orientation in drawing page parameters (Document Parameters > Page > Paper).
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. If the template will be used for creation of reports on the current page, you can skip this step.
4.Create a paragraph text using Text command. Attach it to the nodes of the title block fragment or in absolute coordinates.
Press after selection of attaching points. After that, you need to specify coordinates for new text rectangles using Change paragraph size parameters 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. 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.
5.Add a table header into the created paragraph text. 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.
6.Add tags {group} and {/group} for group of records output.
7.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.
8.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 composition. Its name is No group.
Then add the filter, to the opening tag of the group:
{group hide_table="Group_name = 'No group'"}
9.Add table for new BOM records. Add {list} and {/list} tags.
10.In the third table, you should specify names of product composition columns. Data from the columns will be added to the report. 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.
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:
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"/}
Note! Text of report template should fit paragraph text rectangle. It should not go beyond it by height or width.
Creation of the simplest report template is finished. Finish paragraph text edition using and save your document in the report templates folder (Options > Bill of Materials > Folders > BOM/Report Templates).
Report template should be used for a new report generator, as described in the Reports on Product Composition section.
If a new report generator is created for a product composition type, not for a product composition in the document, it can be used in all documents where the product composition type is used.
It will be necessary to update product composition parameters for the existing documents according to the parameters of the updated product composition 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.
•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.
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.
Example:
{list recursive="true"}
•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.
A macro can process product composition 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"/}
You can find description of elements and attributes for report template in the Report Template Structure section.
•Adding product composition records from template
If you create any product composition records in a report template, then, upon creating a report by such template these records can be added into the current document. This feature is managed by the Add Product Composition Records parameter of report generator. Thus you can, for instance, list reports in product composition. Records added from report template are being deleted, when deleting such report.
Topics in this section: