Adding Parameters and Time Periods in your reports
If you want to customize certain reports like Breadcrumb (BC1000) or Maintenance Service History (MT1000) you may want to add to them the possibility to select Tags instead of a single vehicle/unit. Another possibility could be to add a time period to the Maintenance report where this is not included by default. To do both things we are going to use as a reference the Maintenance Service History report. Follow these steps:
Before and After
- Duplicate the report you want to edit
- Add the Tag parameter
- Add the Period parameter
- Remove the User parameter
- Modify the query
- Save and activate your report
Duplicate your report
To duplicate your report, go to Site Admin-> Reporting-> Manage Reports-> New and select MT1000 Maintenance Service History (if you don’t have this report installed in your system, you may need to download the Maintenance plugin).
Add the Tag Parameter
To add a parameter to your report you need to select the duplicated report under “View” in the listed reports, then click at the bottom on “Query Editor”
The next step is to click on the Query name “MaintenanceQ1” and you will notice that the parameters appear at the right of the screen. Select then “Add parameter”
You have to add the new parameter called Tags as shown in the image below:
Finally click on “Add”.
Add the Period parameter
To add the period parameter you will click again in “Add Parameter” button in the Query Editor and this time you will select “Time Period” as the Parameter type:
Finally click on “Add”.
Remove the User parameter
As we are no longer use the User parameter and we will use Tags instead simply delete this parameter. Remove this parameter in both queries at the right of the screen (select MaintenanceQ1, delete the parameter and repeat the same selecting the query MaintenanceQ2).
Modify the query
Once the parameters has been added, we need to add some conditions in the Query to allow these parameters to work. You will add this SQL sentence after the SELECT:
The following sentence replacing the current parameter [User]:
And finally you will also add the following SQL after the WHERE:
If you have MSSQL database you can copy and paste the same SQL code into the T-SQL selector and save it afterwards. Do the same for both queries (MaintenanceQ1 and MaintenanceQ2).
Don’t forget to save your query in the query editor, if this shows up click on “Save anyway”
After saving the query click con “Back” and then don’t forget to SAVE your report in the Report Layout.
Save and activate your report
Follow this guide to activate your new report in your application.
- How to add custom fields in Maintenance Reports
- Reports customization
- Reports best practices
- Customize report definitions
Discuss this blog post on the forum please