Result Set 20 - HistorianRead Result Set
The following table lists the parameters used in a HistorianRead Result Set.
Order |
Field Name |
Req |
Values/Table Reference |
0 |
Result Set Type |
X |
20 |
1 |
Start Time |
X |
Start Time of Sampling Period |
2 |
End Time |
X |
End Time of Sampling Period |
3 |
Tag |
X |
Tag to Read |
4 |
Node Alias |
X |
The Alias Name of the Historian (Historian Name) |
5 |
Sampling Type |
X |
1 = Average 2 = Interpolated 4 = Minimum 5 = Maximum 6 = Standard Deviation 7 = Total 8 = Cpk 9 = % In Warning 10 = % In Reject 12 = Last Good Value 13 = Count 14 = Next Good Value 15 = Closest Good Value 16 = Increase 17 = Minimum TimeStamp 18 = Maximum TimeStamp 19 = Event TimeStamp 20 = Raw Total 21 = Raw Count 22 = Raw Unique Count 23 = Base TimeStamp - Interpolated 24 = Raw Average 25 = Raw Minimum 26 = Raw Maximum 27 = Raw Standard Deviation 28 = Raw Values 29 = Base TimeStamp - Last Good Value 30 = Base TimeStamp - Next Good Value 31 = Raw Increase 32 = Cp 33 = Pp 34 = Ppk |
6 |
Variable Id |
X |
The Destination Variable where the result should be placed. |
7 |
Lag Time |
X |
Time to wait before reading (in seconds) |
See Also
Partial Sample Code for Using Result Set 20
--Declare the SQL variables used
Declare
@StartTime datetime,
@EndTime datetime,
@Tag varchar(255),
@NodeAlias varchar(50),
@SamplingType int,
@VariableId int,
@LagTime int
--Create a temporary table to hold all variable result set rows
CREATE TABLE #HistorianRead (
StartTime datetime,
EndTime datetime,
Tag varchar(255),
NodeAlias varchar(50),
SamplingType int,
VariableId int,
LagTime int
)
--Set Result Set Variables to values retrieved in your custom code. No
--specific custom code is being show.
Select @StartTime = getdate()
Select @EndTime = dateadd(mi,15,getdate())
Select @Tag = 'MyTagName'
Select @NodeAlias = 'MyHistorianName'
Select @SamplingType = 2
Select @VariableId = 1302
Select @LagTime = 5
Insert into # HistorianRead(
StartTime,
EndTime,
Tag,
NodeAlias,
SamplingType,
VariableId,
LagTime
)
Values(
@StartTime,
@EndTime,
@Tag,
@NodeAlias,
@SamplingType,
@VariableId,
@LagTime)
-- Since the table was created in the same order as the result set
-- we can just place the 20 in front of the output of a "select *"
If (Select Count(*) From #HistorianRead) > 0
Select 20,* from #HistorianRead