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

[PI SDK] FilteredSummaries returns a non-existent value. Options · View
nfcae
#1 Posted : Tuesday, September 14, 2010 3:19:35 PM
Rank: Member
Groups: Member

Joined: 8/23/2010
Posts: 12
Location: Portugal, Lisbon
Hello again Smile,

I have the following code:

Code:

string startTime = "2010-01-01 00:00:00";
string endTime = "2010-01-02 00:00:00";
string filterExp = "Not(IsSet('" + tag.tagName + "', \"q\"))";

NamedValues res = ipiData2.FilteredSummaries(startTime, endTime, "", filterExp, ArchiveSummariesTypeConstants.asAverage, CalculationBasisConstants.cbTimeWeighted, FilterSampleTypeConstants.fstInterval, "10m", null);

IEnumerator enumerator = res.GetEnumerator();
enumerator.MoveNext();

NamedValue nv = (NamedValue)enumerator.Current;
PIValues pi_vals = (PIValues)nv.Value;

double piVal = Convert.ToDouble(pi_vals[1].Value);


For the given interval specified above, there are no values on PI Server (not even DigitalSet's) but still this returns me 1 weird big negative number.. any idea why this happens? It seems to me that somehow he is trying to tell me he doesn't have values by giving a specific negative number..
Also, if possible, is there a way to check if this result set (NamedValues or PIValues) doesn't return anything?

Thanks again,
Phil
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.
RJK Solutions
#2 Posted : Tuesday, September 21, 2010 10:47:48 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Phil, What is the number returned?
Principal Consultant
Real-Time Data Management @ Wipro Technologies
nfcae
#3 Posted : Wednesday, September 22, 2010 11:07:17 AM
Rank: Member
Groups: Member

Joined: 8/23/2010
Posts: 12
Location: Portugal, Lisbon
This is the value returned: -2147219947.0

Tried comparing with some minValue constants in C#:
Double.MinValue: -1.7976931348623157E+308
Double.NaN: just shows me a string 'NaN' in debug mode
int.minValue: -2147483648

Ran the program many times and always returns this same value. You guys think the PISDK function initializes a return variable with this number and when nothing exists it gives this?

int.minValue seems the closest value to what FilteredSummaries returns.

Thanks again Smile
RJK Solutions
#4 Posted : Friday, October 01, 2010 4:52:40 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Phil...did you get an answer on this issue?
I got distracted with other things but will find an answer if you don't already have one...
Principal Consultant
Real-Time Data Management @ Wipro Technologies
nfcae
#5 Posted : Wednesday, October 06, 2010 10:43:35 AM
Rank: Member
Groups: Member

Joined: 8/23/2010
Posts: 12
Location: Portugal, Lisbon
No luck at all, I've also checked what kind of erros this function of PI gives (PI-SDK Help) but doesn't seem like any applies to this one. In the help file they mention something about a constant VT_ERROR but I can't manage to find it anywhere..
RJK Solutions
#6 Posted : Wednesday, October 06, 2010 11:33:20 AM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
It is definitely an error code. Sometimes VBA has it advantages: I created some similar code in VBA where I knew there were no values (e.g. 1975-01-01 00:00:00) on my system using your same parameters and I get returned as the value:

Error -2147219947

Now the number is same as you get but I do get the "Error" string returned in VBA. I guess some internal error number...I will see if there is an explanation somewhere otherwise it is one for OSI to confirm.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
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.