Add Custom Fields in Maintenance reports

Adding custom fields in the Maintenance Reports could be useful if you want to display additional information, for example, the service cost or the replaced parts in the maintenance event, etc. To add custom fields in the Maintenance Reports, follow this guide.

Steps

  1. Install Maintenance plugin
  2. Modify the copy of MT1000/1 report
  3. Test your report
  4. Enable the new report into your application

1. Install Maintenance Plugin

If you haven’t done it yet, follow these steps to setup the Maintenance Plugin. Follow Custom fields in Maintenance in the previous link, to add your custom fields to the system.

2. Modify the copy of MT1000/1 report

    1. Go to Site Admin > Reporting Manage Reports > New and select any of the MT reports. In the example we will use the MT1000.

    1. Click on Query Editor
    2. Click on the top-left MaintenanceQ2 query and add the following statement in the SQL code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SELECT
    MaintenanceQ1.ScheduleID,
    MaintenanceQ1.ScheduleName,
    MaintenanceQ1.ScheduleDescription,
    MaintenanceQ1.EventID,
    MaintenanceQ1.EventName,
    MaintenanceQ1.EventDescription,
    MaintenanceQ1.EventType,
    MaintenanceQ1.Accumulator,
    MaintenanceQ1.MeasureKey,
    MaintenanceQ1.EventRuleID,
    MaintenanceQ1.EventCreated,
    MaintenanceQ1.LogID,
    MaintenanceQ1.UserID,
    MaintenanceQ1.UserUsername,
    MaintenanceQ1.UserName,
    MaintenanceQ1.LoggedByUserID,
    Users.Username AS LoggedByUserUsername,
    Users.Name AS LoggedByUserName,
    MaintenanceQ1.Type,
    MaintenanceQ1.Comment,
    MaintenanceQ1.TimeStamp,
    MaintenanceQ1.AccumulatorValue,
    MaintenanceQ1.Created,
    CustomFields.Name,
    CustomFields.Value,
    CustomFields.Namespace,
    CustomFields.ObjectID
FROM MaintenanceQ1
JOIN Users ON Users.UserID = MaintenanceQ1.LoggedByUserID
LEFT JOIN CustomFields ON MaintenanceQ1.LogID = CustomFields.ObjectID and CustomFields.Namespace = 'Maintenance'
    1. Click on Save
    2. Go back to the Report layout editor and add 2 additional columns (one for the variable [Name] and another for the variable [Value]). These two columns will display the data of the custom fields.

3. Test your report

You can preview the results directly in the Report editor by clicking on Preview.
If you have previously added Custom Fields and logged some events, they should display on the screen as in the following example:


4. Enable the new report into your application

To enable the report into your application follow these steps