Quantcast
Channel: GE Intelligent Platforms e-Forum
Viewing all articles
Browse latest Browse all 2516

SQL Openquery for Historian - TimeGood

$
0
0
Hello,

Trying to create a query to determine how long a tag had a negative value for a given time period. I think this works using the Filtered type query, but can this be done for more than one tag at a time? This is similar to a Time in State query in other tools we have worked with previously.

Select Tagname, [Timestamp], [value], [Value]/1000 as 'Seconds Negative' from OpenQuery(iHISTORIAN,
'SET SamplingMode=Calculated,CalculationMode=TimeGood,
FilterComparisonMode="LessThan",FilterValue="0",
FilterMode="AfterTime",
FilterTag="BS1.B100DPT011.F_CV",
StartTime="2015-04-19 12:00:00.000 AM" ,
EndTime="2015-04-20 12:00:00.000 AM",
NumberOfSamples=1
SELECT Tagname, Timestamp, value FROM ihRawData
')

Viewing all articles
Browse latest Browse all 2516

Trending Articles