Hello
can someone help ?
I am trying to mimic the “time filter” function in the Datalink in excel using SQL
Unfortunately I have problems doing so; I would appreciate any help on the subject.
Currently I am trying using this method:
Select (cast(value as float)) as result
From [PI.ROTEM].[piarchive]..[picalc]
Where expr = ‘timegt(‘’tagname1’’,’’*-10m’’,’’*’’,5)’
And time = getdate()
This gives me the proportion of the time that the tag where grater then 5 however
I have 7 different tags and I need the proportion of time of all the tags.
For example this doesn’t work:
Select (cast(value as float)) as result
From [PI.ROTEM].[piarchive]..[picalc]
Where expr = ‘timegt(‘’tagname1’’,’’*-10m’’,’’*’’,5) AND ‘timeEQ(‘tagname2’’,’’*-10m’’,’’*’’,”ON”) ’
And time = getdate()
It does not give me the UNION of the proportion of both tags it gives me 14m instead of 9m my interval is 10m and I need the proportion of time of both tags in this interval.
Can you help?
Tanks in advance
Pniel