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 by default the Speed information of the vehicle at the moment of the event.

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

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

2. Create your event rule as preferred, and 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 the variable speed and the max speed. To do this, we could add the variable Speed searching from the list of available report argument variables or rather use the variable function $MAX([SIGNAL_SPEED]) into one of the boxes.

mceclip0.png

4. Save your event rule.

Testing your report arguments

No changes are required on the report itself. After adding the two notifications, the report will look like this:

EV100Report

Note: if your report doesn't change, it could mean that you require new data from your devices in order to re-process the changes. You could also reprocess the reports if needed.

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.

Variable Functions 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

For developers: localized report arguments

Report arguments are localized. When creating custom reports including SUM/AVG/MIN/MAX functions, you may be using a culture (time/date display) setting generating decimal values with commas instead of dots, e.g. 45,3 instead of 45.3. That will generate an error in your reports since SUM/AVG/MIN/MAX can only handle decimal values with dots (and not commas). One solution is to modify "45,3" to "45.3".

You can do that using this syntax in your report query:
SELECT REPLACE(price,',','.') AS price, REPLACE(lastprice,',','.') AS lastprice FROM products
 
We aren't using invariant culture in these examples, since we most often want report arguments to be localized. However, you can read more about invariant culture here.

There are functions that can be included to obtain more information: $MAX, $MIN, $START, $FINAL and $END, for example: $MIN([SIGNAL_SPEED])

By default, the value that the variable gets is the one that triggers the event which would be the $START function. In order to use them, just add them on the Report Argument when selecting the variable according to the convention: $FUNCTION([VARIABLE]).

$FINAL() is empty on an ongoing event, and the end value when the event finishes. $END is the last value of on ongoing event, and the end value when the event finishes.