|
|
Rank: Member Groups: Member
Joined: 8/23/2010 Posts: 12 Location: Portugal, Lisbon
|
Hello again  , 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
|
|
|
|
|
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.
|
|
|
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
|
|
|
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 
|
|
|
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
|
|
|
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..
|
|
|
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
|
|
|
|
Guest
|