ValueSummary
Captures key values from a table into the frame.
Parameters
| Name | Default | Meaning |
|---|---|---|
| method | avg | avg, max, min or total |
| columns | Restrict the summary to only specific columns | |
| prefix | Text to add before the name of each value | |
| suffix | Text to add after the name of each value | |
| named | Override the name for the Captured attribute | |
| where | A condition that must be met for the value to be analysed | |
| split | Break the summaries up based on a value | |
Special Rate Parameters
| rate | The value is a rate, controlled by a column value |
| timebase | The number of seconds per time unit |
Description
This function performs simple analytic functions on some (or all) of the columns in a table and captures them.
This can be used to capture min, max, avg or total values across the different columns of your tables.
If you don't specify which columns the analytic should be performed on, it will be applied to all columns.
Example
If the frame contains the following table…
| Time | Speed | Temperature |
|---|---|---|
| 10:00 | 0 | 100 |
| 10:10 | 25 | 100 |
| 10:20 | 50 | 100 |
| 10:30 | 75 | 100 |
| 10:40 | 100 | 100 |
{ "type": "valuesummary", "method": "avg" }
Your frame would then contain…
| Name | Value |
|---|---|
| Average Speed | 50 |
| Average Temperature | 100 |
Working with Rates
If your values represent a rate (such as an amount of production per minute), you can use the two special parameters ('rate' and 'timebase') to change how the analytics are performed.
The first is rate, which should be the name of the column where the speed or flow rate of your process can be read.
The next is timebase, which lets specify the number of seconds that each 'rate' measurement represents. For example, this would be '60' if your rate measurement is in units-per-minute, or 3600 if it's in units-per-hour.
So - for example - if you have scale giving you weight per meter and a sensor giving you meters per minute, you could use the following configuration…
{ "type": "valuesummary", "columns": ["Scale.Weight"], "rate": "Line.Speed", "multiplier": 60, "mode": "total" }
…which would give you a “Total Scale.Weight” figure that contained the total weight of manufactured product.
If you simply want a total of the rate (ie, you wanted a total of the number of meters of production), use the name in both the column and the rate properties. For example…
{ "type": "valuesummary", "columns": ["Line.Speed"], "rate": "Line.Speed", "multiplier": 60, "mode": "total" }
Splitting Results
In some cases, you might want several different summary values.
| Time | Speed | Product |
|---|---|---|
| 10:00 | 0 | Chocolate |
| 10:10 | 25 | Strawberry |
| 10:20 | 50 | Blueberry |
| 10:30 | 75 | Caramel |
| 10:40 | 100 | Bananna |
{ "type": "valuesummary", "method": "avg", "split": "Product" }
Your frame would then contain…
| Name | Value |
|---|---|
| Average Chocolate Speed | 0 |
| Average Strawberry Speed | 25 |
| Average Blueberry Speed | 50 |
| Average Caramel Speed | 75 |
| Average Bananna Speed | 100 |
Naming
This layer gives you control of the attributes written to the Capture.
Without a 'named' parameter, your full value name will be…
<prefix><split><name><suffix>, where the name is made up of <function><column-name>
With the example data below…
| Temperature | Mode |
|---|---|
| 10 | Stopped |
| 20 | Running |
…asking for an average temperature and using no other parameters would give you AvgTemperature with a value of 15.
Where specifying…
| Attribute | Value |
|---|---|
| prefix | Average |
| splitby | Mode |
| named | Temperature |
| suffix | C |
…would give you both Average Stopped Temperature C and Average Running Temperature C, with values of 10 and 20 respectively.