Skip to main content
Version: 6.12

Customising Report Layouts

In Patriot 6, it is possible to customise or completely redesign the report layout to suit the needs of your company. There is standalone software which is required to modify the reports and re-import them into Patriot

These custom report formats offer more control over the layout and styling of the report. A larger number of database fields are also available. Custom reports may require some technical ability to build, depending on the amount of change to the standard report that is required. Patriot support staff are available to build or assist with the building of custom reports. This work is not included in software assurance and will be charged at our standard report customisation rates.

Prerequisites

The Microsoft Report Builder 2016 must be installed in order to edit the report files.

From Patriot Release Build 6.8.1.1 (20.02.19) onwards, we no longer support Report Builder 2 (part of SQL Server 2008 Reporting Services). Patriot can still import files from the old Report Builder software, but if a file has been saved in a newer version of Report Builder, Report Builder 2 will be unable to open it.

Export Process

Reports can be edited from the Reports > Settings > Report Names menu. From here you can see a list of all the reports available in your system and the Report Definition Language Client files or RDLC files. Reports should be created by modifying the existing standard reports provided by Patriot. Select the report that you want to export in the list then click the Export button and the RDLC files will be saved to the location you choose. If you want to make sure that you have the latest report file, click on the web download button and it will be downloaded from the Patriot webserver for you.

note

It is also possible to use the web download button to return the report to the standard layout if required. This will overwrite the existing RDLC file including customisation, so please ensure you have a backup of any customised files before doing this.

Report Settings
Report Settings

Modifying the report layout

Run Microsoft Report Builder 2016. Open the .RDLC file exported above. You may not be able to see the files from Report Builder 2016 as it can only see RDL files. Simply change the file extension to .RDL using Windows Explorer by renaming the file or type in the exact name of the file when selecting it in Report Builder 2016. You may get warnings about selecting a Report Server. You can safely ignore these, as Patriot will configure these settings when the report is run. Simply cancel the Report Server warning and continue editing

Once the report has been opened in Report Builder 2016, you will see a graphical editor that allows you to redesign the report as needed. For example, you can add extra text boxes, change fonts, add sections, and remove unneeded information. The report data itself is provided in a list along the left side of the screen. Extra fields can be dragged from this section onto the report to be included. The full features of the Report Builder are outside the scope of this document. More information can be found on the Microsoft website and around the web.

Report Builder UI
Report Builder UI

Adding Report Images and Charts

Images can be added to the report file by selecting Insert > Image. For standard fixed images (e.g. Monitoring Station logo), select the image source as Embedded, and browse to the required file. The image will then be copied inside the .RDLC file itself, and the original is no longer required.

For larger images the External image source option is recommended. With this mode you can provide a URL link to the image. The link needs to be accessable from all Patriot workstations and servers that will need to generate the report. This option is also useful for GraphQL reports where you can query for image URL's to display on your report.

It is also possible to define a per-user image (e.g. for Dealer Branding, or Installer Logos). See Dealer Branding for information on how to save the images and enable branding.

Once this is configured, change the image settings in the RDLC file to match the following:

Image source : Database.

Use This Field:

=First(Fields!InstallerLogo.Value, "PresetReportDataSet")

Use This MIME Type:

=First(Fields!InstallerLogoMIME.Value, "PresetReportDataSet")

On the Visibility tab, select Show Or Hide Based On An Expression and set the expression to:

=IsNothing(First(Fields!InstallerLogo.Value, "PresetReportDataSet"))

This will display the dealer image as required, and hide the image area if the user has no image or if the report is being run for a single client grouping. Images will not be included if Dealer Branding is disabled.

Charts can be added to the report file by selecting Insert > Chart. To display the chart in the RDLC you must install the Report Runner Files and extract into the Patriot Reporting Components installation directory. You can download a copy of the required files from Report Runner (Data Visualisation Files).

note

Patriot enforces a maximum file size for RDLC files when importing. Because standard images and charts are stored inside the .RDLC file, embedding a lot of images and charts could cause the maximum file size to be reached. If this happens, use smaller images, use the External option to link to external images, or remove unnecessary items to reduce the file size.

Importing the file back into Patriot

Once the file is modified to suit, you can import it back into Patriot to test. Simply return to the Reports > Settings > Report Names menu in Patriot. If you wish to replace the existing report, you can select this report, browse to your new file, and import it.

It is also possible to create a new report so that multiple layouts for the same report can be used (e.g. for different customers). To do this, click on the + button, and enter the details. Select the same Report Type from the selection menu to make sure that the correct data is loaded for the report. Then, import your layout file as before.

You may need to log out and back in on the Patriot client before the new report appears in the menu.

Custom reports available for download

There are some examples of existing custom reports available from the following page:

Downloadable Custom Report Layouts

Available Datasets

Different report types have different datasets loaded. You can find datasets of different report types here in the Report Datasets page.

Incident Report Details Customisation

The Incident Report contains some information which is pre-processed by Patriot before being displayed in the RDLC, such as activation creation time, operator actions, and provided notes. Due to this information being processed before the RDLC layout, it is not possible to edit the information in the standard way. The phrases used can be edited through the translation options. See the translation documentation for a general overview of translating segments of Patriot. Once translation is set up, change the required phrases in the IncidentReportRes file. If a certain piece of information is not required in the report, leave the translated phrase blank. This will remove the phrase and the associated information. Ensure that the 'Translated' check-box is enabled to include the blank phrase. By default, a blank phrase indicates to use the original English phrase instead of translating.

note

The translated language resource (en) folder needs to be copied in to the Patriot Reporting Components folder for translated strings to work with reports.

Phrase NameDefault ValueBlank Value Effect...
PickupOperator"Operator"Operator ID does not appear on report.
PickedUpActivation"Picked Up Activation"Activation ID number does not appear on report.
OperatorResponseTime"Response Time"Operator response time does not appear on report.
OperatorNameSeparator": "Operator name does not appear on report.

The Incident report can also be customised to include or exclude certain operator actions displayed in the report. See the Include Note Type On Reports setting in System Wide Settings for an overview of the operator actions. These settings allow the option to display which actions are relevant to the report and omit the actions which aren't relevant to the report.

Date Format Override

By default the windows report running formats dates and times using base formats such as Short Date and Long Date that are defined by windows Time and Language settings on the machine running the report. Below is an example of a formatted date/time from the Log Report.

=FormatDateTime(Fields!RecDateTime.Value, DateFormat.ShortDate) & " " & FormatDateTime(Fields!RecDateTime.Value, DateFormat.LongTime)

For reports run through a task these formats are based on the task servers settings and for reports run manually these are based on the local workstation settings. Date/time formats being defined locally is usually not a problem as any servers or workstations in the same locale will most likely have the same Time and Language settings and if you have clients across multiple regions you can let their own region settings apply to reports they run. But if you want or require a static date/time format or a consistant specific date format on all your reports this may be a concern.

Additionally some installations of windows can have default or fallback Regional or Language settings affect date/time formats in hidden ways even if your workstations are all local. For example you can encounter differences between reports ran on Windows 10 installed from a US-English ISO file and a UK-English ISO file and the default fallback language can be used in some instances. These problems can be hard to pin down and resolve just by changing Windows settings.

To set a specific date/time format not dependant on any Windows settings you can replace the datetime expression in any report that formats using FormateDateTime which works specifically on Dates and Times to Format which works on Strings, and then specify a specific date time format. Below is an example for the same Log report using Format to force a US date ordering and 12 hour time.

=Format(Fields!RecDateTime.Value, "MM/dd/yyyy hh:mm tt")

A full list of the possible date/time format options can be found on this Microsoft's Docs page

Client Number Display

In the Patriot Client the Client ID, Area, and Port ID of a Client is typically displayed with the Client ID and Port ID separated by a hyphen, with the Area included in brackets if it exists. For example:

0001-01 means Client 0001, Base area, port 01.

0022(4)-01 means Client 0022, Area 4, port 01.

In the Patriot database, these numbers are stored as a single string with no separator characters. For the above examples, these would be 0001BASE01 and 0022000401.

If you want your report to use the more readable format used in the Patriot client, you will need to insert some code into the report to format the database string to a new field, then use the code as part of an expression wherever the Client_No field is used in the report.

Right click in empty space around the report, then click Report Properties, then switch to the Code tab.

Adding custom code
Adding custom code to a report

Copy and paste the code from the box below into the Code tab:

Public Function ClientNoDisplay(ByVal clientNo As String) As String
If IsNothing(clientNo) Or clientNo.Length < 7 Then
Return ""
Else
Return clientNo.Substring(0, clientNo.Length - 6) + GetArea(clientNo) + "-" + Right(clientNo,2)
End If
End Function

Public Function GetArea(ByVal clientNo As String) As String
Dim AreaNo As String
AreaNo = clientNo.Substring(clientNo.Length - 6, 4)

If AreaNo = "BASE" Then
Return ""
Else If AreaNo = "0000" Then
Return "(0)"
Else
Return "(" + AreaNo.TrimStart("0") + ")"
End If
End Function

Save your report. Now you can use the code as part of an expression. Right click on a textbox that will contain the client number, and click on Expression to bring up the expression editor window.

Using custom code
Using custom code within an expression

To use the custom code to format the client number, enter the following expression:

=Code.ClientNoDisplay(Fields!ClientNo.Value)

Action Plan Colours

Patriot Action Plans are identifiable by their configured colours. It is possible to format a report using the colour information and make it easier to read and identify. If you want your report to use Action Plan colours used in the Patriot client, you will need to insert some code into the report to format stored colour value, then use the code as part of an expression when defining the colour of a report object.

In a Report's Properties (Right click in empty space around report, then click Report Properties, then switch to Code tab) input the following code:

Public Function ColorRGB(ByVal Value As String) As String

Dim ColourInt as Integer
Dim RHex as String
Dim GHex as String
Dim BHex as String
ColourInt = CInt(Value)

RHex = Hex(ColourInt And 255)
GHex = Hex((ColourInt >> 8) And 255)
BHex = Hex((ColourInt >> 16) And 255)

Return "#" + RHex.PadLeft(2,"0") + GHex.PadLeft(2,"0") + BHex.PadLeft(2,"0")
End Function

Now you can reference the code in the document. When selecting the colour for any Text, Line, or Fill instead click the Expression button next to it and input the following Expression:

=Code.ColorRGB(Fields!RowColour.Value)

Setting the colour of text using the Action Plan Expression
Setting the colour of text using the Action Plan Expression