Report arguments - passing parameters to your event-based reports

This guide shows how to send additional information to your Event Rule reports directly from the event rules using report arguments.

How to use report arguments

When we generate the standard EV1000 report, we will get the usual information (Start Date, Start Time, Duration, Vehicle, etc). But, for example, we don't have the Speed information of the vehicle at the moment of the event by default.

To add a new variable (eg. Speed), follow these steps:

1. Open your event rule wizard under Main Menu > Admin > Event Rules

2. Create your event rule as preferred.

3. On step 5. Notifications select + to add a new notification type.

3. Select Report Argument as a notification type.

Using report arguments, we can easily include different report arguments such as speed and many others like:

mceclip0.png

4. Save your event rule.

Reports

After saving an event rule with the report arguments, you can run, for example, the EV1000 report. Remember to select in the report parameters to the right, the event rule that contains the report arguments:

mceclip1.png

Note: if you modify the Event Rule, and the report was previously run with the exact same parameters, you might need to reprocess the reports to see the changes applied. 

Variable Functions

In many cases, it is useful to use functions to get a more suitable result from a variable. For example, you can obtain the maximum or minimum speed of a vehicle during an event.

There are in total 5 functions that can be used in conjunction with variables:

  • $START: The first value of the variable when the event starts
  • $END: The last value of the variable when the event is still active but is about to end
  • $FINAL: The final variable value when the event ended
  • $MIN: The minimum value of the variable while the event is active
  • $MAX: The maximum value of the variable while the event is active

By default, the value of the variable is the first value when the event starts. It behaves in the same way as the $START function.

Example

Let's assume as an example, that you have an event rule monitoring a temperature signal over 10 degrees. The event rule has processed the following temperature values: [5, 11, 13, 12, 9]

The output for the different functions will be:

$FIRST([Temperature]) -> 11
$END([Temperature]) -> 12
$FINAL([Temperature]) -> 9
$MIN([Temperature]) -> 11
$MAX([Temperature]) -> 13

Localized Report Arguments for Developers

When creating custom reports, keep in mind the following:

Handling Decimal Values in Localized Reports

  • Report arguments are localized, meaning they adhere to culture-specific formats (e.g., time/date display).
  • Decimal values may use commas instead of dots, such as 45,3 instead of 45.3.
  • Issue: Functions like SUM/AVG/MIN/MAX require decimal values with dots (.) and cannot process values with commas (,), resulting in errors.
  • Solution: Replace commas with dots using the following syntax in your report query:
    SELECT REPLACE(price, ',', '.') AS price, REPLACE(lastprice, ',', '.') AS lastprice FROM products
    

Note on Culture Settings

  • In these examples, we avoid using invariant culture since report arguments are generally localized.
  • However, if needed, you can explore invariant culture settings to learn more.

Report Functions for Additional Information

Several predefined functions provide insights in your reports:

  • $MAX, $MIN, $START, $FINAL, and $END.
  • Example: $MIN([SIGNAL_SPEED]).

Explanation of Functions

  • $START: The value that triggers an event.
  • $FINAL: Empty during an ongoing event but shows the end value once the event concludes.
  • $END: The last value during an ongoing event, or the end value when the event finishes.

How to Use Functions

To include these functions in your reports, follow the convention:

$FUNCTION([VARIABLE])

For instance, to retrieve the minimum speed from a signal, use:

$MIN([SIGNAL_SPEED])