1. Navigate to the Reports folder on the AccountServer (the default path is: C:\ProgramData\Attix5 Pro\AS_Service\Reports). Create the folder if it doesn’t already exist.
2. Create a new folder with your new report category name, e.g. Accounts (which will then be located at C:\ProgramData\Attix5 Pro\AS_Service\Reports\Accounts).
3. In this new category folder, create an XML file that contains the new report template's details, including report name and description, report template file name, admin-only access (true/false), and other parameters (optional).
Example:
To create a report template called AccountsAll that is available to Administrators only and describes all backup accounts for a specific group, create an XML file called AccountsAll.xml with the following content:
<report name="AccountsAll" admin="true">
<desc>All Accounts for specified Backup Group.</desc>
<reportFilename>AccountsAll.html</reportFilename>
<params>
<param type="String" name="Group" alias="GROUPNAME">
<desc>Group Name</desc>
</param>
</params>
</report>
4. On the AccountServer, in C:\ProgramData\Attix5 Pro\AS_Service\Reports\<Category>, create a file with the same file name as your XML file, but with an HTML extension (for this example, it would be AccountsAll.html). Include the following in the HTML file:
- Basic HTML formatting to represent static content such as report style and layout
- Sub-template placeholders (between <? and ?>) to represent dynamic content that may be re-usable or report-specific
Example (continuing from above):
In the <body>
of the HTML report template, you could include a <div>
element containing a set of sub-template placeholders that represent a generic report header and footer, as well as a report-specific sub-template that represents the dynamic content. Here, the contents of a sub-template called ReportCSS will replace the <?ReportCSS?>
entry whenever a report is generated. Similarly, the contents of the ReportDesc, ReportHeader, AccountsAll, and ReportFooter sub-templates will replace their placeholders.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <?ReportCSS?> <title><?ReportDesc?></title>
</head>
<body>
<div> <?ReportHeader?> <?AccountsAll?> <?ReportFooter?>
</div>
</body>
</html>
5. Navigate to the ReportTemplates folder on the AccountServer (the default path is: C:\ProgramData\Attix5 Pro\AS_Service\ReportTemplates). Create the folder if it doesn’t already exist.
6. Create an SQL file (for this example, it would be AccountsAll.sql) and define one or more database queries to retrieve the information you want to include in the report.
7. In order to format the information pulled from the database/s, create an HTML file in C:\ProgramData\Attix5 Pro\AS_Service\ReportTemplates to serve as a sub-template for reports (for this example, the sub-template could be ReportDesc.html, ReportHeader.html, ReportCSS.html, etc.).
8. In this sub-template, format the data pulled by the SQL query/ies by placing the SQL identifiers, surrounded by dollar signs ($), into an HTML layout.
9. If you want to control an element of the report in isolation while also including dynamic data in that element, you can create a sub-template that refers to another sub-template.
Example (continuing from above):
To control a report header which includes dynamic data in the form of a report description (which changes depending on the report), you can create a header sub-template that refers to a report description sub-template. You will then have three files:
ReportHeader.html
<!-- Header -->
<table id="container" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td class="ReportName"> <?ReportDesc?>
</td>
<td class="logo" align="right">
<img src="/Logo.png" alt="Logo"/>
</td>
</tr>
<tr>
<td height="5px" colspan="2">
</td>
</tr>
</table>
<!-- End Header -->
ReportDesc.html
<$Description$>
ReportDesc.sql
Select Description from Report where Name is
<?system.ReportName?>
Any report template that uses the ReportHeader sub-template will now apply the formatting specified in the ReportHeader.html file and get the relevant report description from the ReportServer using the ReportDesc.html sub-template and ReportDesc.sql file’s SQL query.
For more customisation options, download the Enterprise Reports User Manual:
Comments
0 comments
Please sign in to leave a comment.