Live Data Computation Agent – SERIES_FUNCTION_INFO

<< Click to Display Table of Contents >>

Navigation:  Live > Agents > Transformation Agents > Data Computation > Parameters >

Live Data Computation Agent – SERIES_FUNCTION_INFO

The computed series' SERIES_FUNCTION_INFO for the Live Data Computation Agent must contain a JSON (JavaScript Object Notation) string that contains one or more of the following parameters.

 

Parameter

Description

sourceSeriesId

An array of integers containing one or more LOGGER_SERIES_ID values that represent the source data for the computed series. The source series may come directly from a data logger or it may be another derived/computed data series.

declare

A string that declares and sets one or more user-defined SQL variables (e.g., @depth and @angle).

The user-defined SQL variables can be set using any of the predefined SQL variables (e.g., @target_series_id), and they can be used to calculate the value or passed to the stored procedure.

value

A string that is a SQL expression used to calculate the computed value. It may include a scalar-valued function, and use one or more SQL variables.

The value is optional if using a procedure.

If using multiple source series, and multiple datum have the same date-time, the value must include an aggregate function (e.g., MAX).

d may be used to refer to a source series DT_LOGGER_DATUM row, and ? to refer to d.datum_value. For example:

? = d.datum_value = a source series DT_LOGGER_DATUM.DATUM_VALUE.

d.datum_utc_dt = a source series DT_LOGGER_DATUM.DATUM_UTC_DT.

See the INSERT INTO @temp_datum... in Example 2; it's similar to how the Data Computation Agent handles the value.

procedure

A string that is a SQL expression to execute after the value computation is completed.  It may call a stored procedure, and pass in one or more SQL variables.

The procedure is optional if using a value.

round

Optional, round the computed series' DT_LOGGER_DATUM.DATUM_VALUEs to this number of digits; positive values round to the right side of the decimal point, while negative values round to the left side of the decimal point. To truncate instead of round, add a comma and a one to this value. Examples:

"round":3: e.g. rounds 123.456789 to 123.457

"round":0: e.g. rounds 123.456789 to 123

"round":-1: e.g. rounds 123.456789 to 120

"round":"3,1": e.g. truncates 123.456789 to 123.456

 

Note: If there is an error in the value or procedure, the Data Computation Agent will log an error message containing the erred SQL script that can be run/debugged in SQL Server. If the changes are not being saved to the database, the SQL script will contain the temporary table '#temp_dt_logger_datum' which can be replaced by 'DT_LOGGER_DATUM' in the SQL script.

 

The Data Computation Agent does not have a deleteInputDataAfter parameter like the Data Deriver Agent. The Data Expiration Agent may be used to delete DT_LOGGER_DATUM rows when they are no longer needed.