Editing a Report Template
<< Click to Display Table of Contents >> Navigation: Screen Reference > Menus > Reports > Report Designer > Editing a Report Template |
The report template is used to generate the actual report. You can insert tables, columns, add/ remove fields or functions and so on. All report fields/ functions are enclosed in double square brackets (e.g. "[[wo.category]] ").
Instructions
Edit the report as you would using any word processor. Enter text and format it using the icon buttons. Hovering the mouse over the buttons displays tool tips explaining what each one does. The first button toggles between Design view and HTML view (you can also use the HTML View/ Design View button above the template to the right).
If you insert any pictures & links make sure that the files are in locations available to all users e.g. a public website or shared folder. Otherwise you will be able to access them but others will get errors when trying to access them from some other computer (pictures will not be displayed and links will not work).
Insert/ Modify fields: Click on a field/ function in design view to change the field/ function. Insert fields and functions at a particular location by moving the cursor there and then clicking on the Insert Field button. Once a field is selected, you can also use drag and drop to move it around within the section (Header/ Detail/ Footer) it was created in.
You can create new fields for an item (e.g. a new warranty date field for equipment) that can be displayed on the report by selecting Administration, Define Custom Fields for that specific item type (e.g. equipment). This new field will now be visible when you click on the Insert Field button.
Detail record field: For example an equipment field on a work order report can occur multiple times - once for each equipment on the work order, a part field on an equipment report can occur multiple times - once for each part associated with the equipment. In such cases insert a list (use the numerical list/ unordered list toolbar buttons in editor) before the field e.g.
•[[equipment.name]]
HTML view (experts only!): Review and directly edit the HTML code here. Do not put in the <html>, <header>, <body> tags as they are automatically be inserted - duplicate tags may cause your reports to look odd! You can use most tags normally found within the <body> section of HTML documents. For fields/ functions make sure that there are no spaces between the square brackets.
DO NOT delete or move around the Header, Details or Footer sections otherwise your report will produce errors or be incorrect if you try to use this template. If you accidentally do this, you may need to delete this template and start afresh if you have saved your changes.
Components Of A Report Template
•Sections: A report template contains three sections:
1.Header Section: It can contain report title, summary information, etc. It is marked by the tag [[report.header]] in HTML View.
2.Details Section: It contains the actual content of the report e.g. work order details, part details, etc. It is marked by the tag [[report.detail]] in HTML View.
3.Footer Section: It can contain summary information (e.g. report totals). It is marked by the tag [[report.footer]] in HTML View.
•Report Functions: Function names are case insensitive. Functions may also be nested e.g. [[FormatCurrency(total(wo.laborcost))]] will format the total labor cost of all work orders retrieved in the current currency format.
•Avg: Gets the average of a numeric column e.g. [[avg(wo.laborcost)]].
•Count: Gets the numer of rows/ records found e.g. [[count(wo.name)]]
•Total: Gets the total of a numeric column e.g. [[total(wo.laborcost)]]. Typically used in the report's footer section to get totals.
•FormatCurrency: Formats a numeric value into the current currency format e.g. [[formatcurrency(wo.laborcost)]].
•FormatDate: Formats a date value into the current date format e.g. [[formatdate(wo.completeddate)]].
•FormatDuration: Formats a time duration value into the hour & minute format e.g. [[formatduration(wo.actduration)]].
•FormatTime: Formats a time value into the current time format e.g. [[formattime(wo.StartTime)]]
•IfPresent: Takes two or three arguments e.g. [[IfPresent(equipment.description, equipment.description, "-No description-"]]. If the first argument evaluates to empty/ null, it returns the third argument or nothing if no third argument is supplied. If the first argument is present and not empty, it returns the second argument.
•RowNum: Gets the row number of the current record being processed e.g. [[rownum(wo.name)]].
•DrawChart: Draws a chart of the specified type. Parameters are:
oType: Can be “barchart”, “linechart” or “piechart”
oWidth: Chart width in pixels
oHeight: Chart height in pixels
oChart title
oHorizontal axis title
oHorizontal series data
oVertical axis title
oFirst vertical series name
oFirst vertical series data
oSecond vertical series name (optional)
oSecond vertical series data (optional)
oThird vertical series name (optional)
oThird vertical series data (optional)
•Report Variables: Variable names are case insensitive. Enclose variable names in square brackets e.g. [[report.date]].
•report.date: Returns date report was created.
•report.dump: Returns a full list of all parameters available in a report section. Useful if you want to find out what variables and records are available in a report section.
•report.newline: Returns a line break (useful for formatting).
•report.null: Returns an empty value. Useful as a placeholder - say as a second argument for the IfPresent function. E.g. [[ifPresent(eqp.name, report.null, report.commentstart)]] - this will comment out a report section if no equipment records are found.
•report.pagebreak: Produces a new page.
•report.space: Returns a single space. Useful for formatting.
•report.commentstart: Starts an HTML comment. Useful to use with the IfPresent function to comment out (hide) unused sections of a report. Must be used along with report.commentend. See the "Location History" report template for an example of how this is used to show/ hide equipment information based on whether the checkbox to list all equipment in a location is selected.
•report.commentend: Ends an HTML comment. Useful to use with the IfPresent function to end a comment out (hide) unused sections of a report. Must be used with report.commentstart.
•Make sure that there are no spaces within the double square brackets e.g. something like "[ [" or "] ]" will cause items not to be recognized.
•Avoid using HTML code in function arguments (e.g. in the IfPresent function). This can cause problems depending on the input data.
•Use the [[report.dump]] tag to get a detailed list of variables available in a report section if the report generator cannot find a requested parameter.
•You can switch the Report Template to HTML mode (click HTML View) to see the raw HTML code and hence locate the cause of some hard to find errors.
•If a field/ function does not display correctly make sure that you have not moved it from the section (Header/ Footer/ Detail) that it was created in originally.
•Seeing extra columns or rows in a table? If a field is detail record field it may have multiple values for each master record field (e.g. more than one part record associated with each work order record). You may need to put such fields in their own sub-table or in a list by inserting a list symbol before the field (use the numerical list/ unordered list toolbar buttons in editor). Otherwise you may see an extra table column or row for each occurrence of this field.
•Problems with tables? If the table does not fill the width make sure that table width is set to 100%. Blank table cells not displayed when you print or create a PDF. If you want them displayed (because they have a border or margin) put something in the cell. For example you can change a cell like "<td ……. ></td>" to "<td ……. > </td>" (" " is a non-breaking HTML space). To make text in a table cell bold use "<th>" rather than "<td>" e.g. rather than "<td><strong>My Heading</strong></td>" use "<th>My Heading</th>".
•Font sizes & styles: If you want to make specific sections of a report larger e.g. "Planned Date" field in the "Work Order: Detailed" report you have to edit the HTML style. The report editor fonts are not used on the final report since it is generated based on HTML 5 styles. To change the HTML styles click HTML View.
Change:
<p>Date: [[wo.planneddate]]</p>
To:
<p style="font-size: 200%;">Date: [[wo.planneddate]]</p>