YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

calculating proportion of time Options · View
Pniel
#1 Posted : Wednesday, March 23, 2011 1:24:41 PM
Rank: Newbie
Groups: Member

Joined: 3/23/2011
Posts: 2
Location: Israel
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



Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.