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

Query Constrain on Annotations Options · View
Michael Morris
#1 Posted : Monday, September 14, 2009 4:09:38 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2009
Posts: 4
Location: Boston
Is it possible to execute a query using PI-OLEDB restricting the results to only those where the 'Annotations' field matches a particular pattern? For my data, I have a scale factor, an offset factor, and an optional QC flag for each observation of the form:

0.33,0.76,12222200000000

What I want to accomplish is to find the last observation that has a QC flag assigned to it (so the QC can start from that point). I am using the query:

Code:
select top 1 time from picomp2 where tag = 'poplar_greenwood_1_2151_2.0_P1_Avg' and annotations like '*,*,*' order by time desc


However, when I execute the query, I receive the following error message:

Code:

??? Invoke Error, Dispatch Exception:
Source: PIOLEDB
Description: Overload resolution failed for (LIKE) argument(s).


Thanks in advance for any help.
Sponsor  
 
RJK Solutions
#2 Posted : Tuesday, September 22, 2009 12:21:05 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 409
Location: Cheshire, United Kingdom.
Hi Michael,

To use the LIKE operator you need to compare against a string.
As annotations is a Variant, cast it as a string then use your LIKE pattern match.

Code:

select top 1 time from picomp2 where tag = 'poplar_greenwood_1_2151_2.0_P1_Avg' and CAST(annotations AS String) like '*,*,*' order by time desc


Cheers,

Rhys.


OSIsoft PI System Specialists
PI consultancy on PI Systems, PISDK, AFSDK, OLEDB etc and PI custom developments. Well pretty much anything to do with PI!


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.