When integrating measure values using calendar context, the following parameters can be used as placeholders in SQL queries to insert or update data.
Properties available to use in the query:
|
Requires CamelCase as shown. This will be replaced by the value of the model attribute configured on the measure based on the name of the model attribute. If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the value of the description of the measure. If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the string value of the measure’s interval type (Minutely, Hourly, Shiftly, Daily etc.). If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the string value of the name of the measure’s parent entity. This can be either a metric or an event. If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the integer value of the measure’s unique ID. |
|
This will be replaced by the string value of the measure’s name. If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the string value of the measure’s unit of measure that has been configured. If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the string value of the measure’s hierarchical name up-to metric of event level. If no value is found, it will be replaced by a blank string (“”). |
|
This will be replaced by the double representation of the measure’s value per time period interval. If no value is found, it will be replaced by NULL (“NULL”). |
|
This will be replaced by the most recent timestamp the measure value had been changed. |
|
This will be replaced by the most recent timestamp, in UTC, the measure value had been changed. |
|
This will be replaced by the Date Time value of the current time period’s end time being processed. |
|
This will be replaced by the Date Time value of the current time period’s start time being processed. |
|
This will be replaced by the UTC Date Time value of the current time period’s end time being processed. |
|
This will be replaced by the UTC DateTime value of the current time period’s start time being processed. |
|
This will be replaced by the integer representation of the measure’s value quality score, based on the OPC quality code as received from the data source for that time period interval. |
|
This will be replaced by the integer representation of the duration, in milliseconds, of the particular time period interval. |
|
This will be replaced by the integer representation of the current version of the value. |
|
This will be replaced by the integer representation of the unique timeperiod id of the specific time period interval. |
|
This will be replaced by the integer representation of the unique measure value ID of the specific time period interval. |
|
If event context is added to the measure, each of the attribute values will be replaced for the current time period interval. |
|
If event context is added to the measure, each of the attributes will be replaced for the current time period interval. |
|
All values will be pushed to the consumer. This include all versions, not just the latest value. The preferred flag will be set as a Boolean (true/false) to indicate if the current value in the value set is the preferred value or not. |
|
If the current version had been changed manually by a specific user, the username ID will be replaced with the unique ID of the user configured in Flow that modified the value. If no user made changes to the value, it will be replaced by a blank string (“”). |
Note: For Time Periods and any string values, please remember to add single quotes (') before and after the placeholder parameters.
Microsoft SQL Example
update ERPStaging setValue=[MeasureValue] where DateTime='[PeriodEnd]' IF@@ROWCOUNT=0 insert into ERPStaging (DateTime, Value, tagname, TimePeriodId, MeasureId) values ('[PeriodEnd]',[MeasureValue], '[MeasureName]', [TimePeriodId], [MeasureID])
MySQL Example
update ERPStaging setValue=[MeasureValue] where DateTime='[PeriodEnd]' IF@@ROWCOUNT=0 insert into ERPStaging (DateTime, Value, tagname, TimePeriodId, MeasureId) values ('[PeriodEnd]',[MeasureValue], '[MeasureName]', [TimePeriodId], [MeasureID])
PostgreSQL Example
do $$ begin update ""schema"".""ERPStaging"" set""Value"" = [MeasureValue] where ""DateTime""='[PeriodEnd]' and ""MeasureId"" = [MeasureID] IF NOT FOUND THEN insert into schema.""ERPStaging"" (""DateTime"", ""Value"", ""Tagname"", ""TimePeriodId"", ""MeasureId"") values ('[PeriodEnd]', [MeasureValue], '[MeasureName]', [TimePeriodId], [MeasureID]) end if; end $$