Report Tab

When you open a Report item from the Reports tab on the ItemType window the Report Tool opens. This is the standard Tear off Item Window including the standard menu bar and toolbar. Below that is the Report tab bar allowing you to switch between the Report details and the XSLT style sheet text editor. This section describes the Report tab, which is the Report Form. The Report tab is the page where you set up the Report. Here you provide its name, its type, the target window to show the Report results plus set up the query criteria to generate the data for the Report.

The following screenshot shows a sample Report that is of type ItemType, meaning the Report Query is a static query that searches for Vendor items. The AML query also limits the results by defining only the properties desired using the select attributes. The target is set to One Window, so the Report appears in a separate window when run from the client.

Table 3 provides a description for each field on the Report Form.

Report Form Fields

Field

Content/Comments

Name The Report name
Description The Report description
Type
Target Where to show the Report results: in the main window, its own window, and all reports in one window.
Location Where the method for generating the Report is evaluated on the client or server.
Report Query The AML query or XSLT style sheet to make the AML query from the item depending on whether the type is set to Item or ItemType.
Label This allows us to specify the text, in different languages, of Menu entry for this Report under the Reports Menu of the Client interface.

When the Report type is set to ItemType or Generic, the Report Query is the static AML query used to generate the data for the Report. The following attributes are very useful to help filter and control the results for your Report.

  • select: the select attribute is used to define the set of properties you want returned from the query. This is a comma delimited list of property names (not the property label). It is identical to the select clause in SQL if you are familiar with relational database technology. You can gain significant performance improvements to your Reports by limiting the data returned from the query.
  • The following example illustrates the select attribute by selecting the item_number, description, and cost properties from the Part ItemType: <Item action="get” type="Part” select="item_number,description,cost"/>

  • order_by: the order_by attribute is used to order the results. The Report Tool offers the ability to sort the data in a variety of ways but sometimes you may want the data in a pre-sorted order. This is a comma delimited list of property names (not the property label). This is identical to the order by clause in SQL if you are familiar with relational database technology.
  • The following example illustrates the select attribute by selecting the item_number, description, and cost properties from the Part ItemType: <Item action="get” type="Part” select="item_number,description,cost” order_by="item_number"/>

  • page & pagesize: if you are performing a query for items and you know that there can be hundreds or thousands of items, you can limit the number of items returned by using the page and pagesize attributes. Together they control how many items to return (the pagesize) and which page to return.
  • The following example illustrates the select attribute by selecting the item_number, description, and cost properties from the Part ItemType: <Item action="get” type="Part” select="item_number,description,cost” order_by="item_number” page="1" pagesize="50"/>

  • Relationships – often you want the relationship items in addition to the source item to generate a Report showing the items configuration. The query may contain the <Relationships> tag to hold the <Item> tags for the relationship items you want included in the query results. The <Item> tags can themselves include the same control attributes.

The following example illustrates the Relationships tag to include the BOM relationships. Notice the select attribute for the BOM type Item defines the properties to be returned for the BOM relationship item plus the properties for the Part item referenced by the related_id property, which is defined within the parenthesis following the related_id property: <Item action="get” type="Part” select="item_number,description,cost” order_by="item_number"> <Relationships> <Item action="get” type="Part BOM” select="qty,ref_des,related_id(item_number,description,cost)"/> </Relationships> </Item>

When the Report type is set to Item, the Report Query is an XSLT style sheet. Use the stylesheet to transform AML for the selected item into a new AML query that you can use to query the data for the Report. The reason for creating the new query is that the item selected tends not to already include the item relationships, so you need to generate the actual query dynamically using the data known from the selected item. For example, the following is an XSLT style sheet that transforms a Part item into a new AML query for a BOM Report. Notice that for the most part this is an AML query but because it’s an XSLT style sheet the Attribute value templates {…} can be used to substitute values inline from the selected item. The text within the curly brackets is evaluated as an expression, which in this case is simply returning the values for the type and id attributes from the selected item.

<Item
 action="get”
 type="{@type}"
 id="{@id}"
 select="item_number,description,cost">
 <Relationships>
 <Item
 action="get”
 type="Part BOM”
 select="qty,ref_des,related_id(item_number,description,cost)"/>
 </Relationships>
</Item>