It seems like the RemoveValues() method in the PI-SDK ignores the milliseconds portion of the start and end date parameters. Is this true? Thanks.
Here is a little treasure I found after some more searching. Thanks to Arnold Woodall and Isaak Peretsman :-)
KB01070 - Possible loss of subsecond precision when using PITime.LocalDate property in .NET
No, it should work fine with milliseconds. Can you give us more details (code snippet, sample of data at the time boundaries, product versions)? Do you encounter any errors? Is your app standalone Visual Basic/etc. or is it VBA module you've written to extend another application (e.g. Excel/PI Processbook/etc.)?
It's a stand-alone windows app (written in C#) that uses the PI-SDK 1.4.4
After trying out some more, I found that - yes it works with milliseconds. However, there is one entry that won't get deleted and I believe I’m running into a precision issue.
This is what the data looks like if I display them using PI-SMT:
The first and third records get deleted, but the highlighted record in the middle does not. After digging into the code more, it looks like the DateTime object (Windows C#) can only handle up to 3 digits of the milliseconds. So for the highlighted record, the precision gets truncated to ‘.250’. I try to force the format to have more precision but the rest of the numbers just get zeroed out.
Thanks for looking.
You should be able to use DateTime ticks for this - one tick is 100 nanoseconds, it should give you the desired precision.
Thank you for finding this for me! This is exactly what's happening. And as the article says, AFSDK is not affected by this because a colleague and I tested it and it works. At least now I have another work-around.
PI SDK is announced to become deprecated. We strongly suggest considering AF SDK for recent development projects.
Retrieving data ...