I am curious as to why you don't simply use afattribute.GetValue().Value to get the snapshot for the attribute (regardless of whether or not that attribute is a PIPoint)?
I have tested this on both AF 2.5.2 and 2.6.1 and I am not able to reproduce this problem. With both versions, I am able to get the correct value back. Here are my steps I tried to reproduce:
1) Create an attribute that points to PI tag sinusoid
2) Create a child attribute under the above attribute that points to sinusoidu.
Then I execute the below code:
PISystems afServers = new PISystems();
AFDatabase afDB = afServers["dlwin2k8r2x64"].Databases["Database3"];
AFElement elem1 = afDB.Elements["Element7"];
AFAttribute attrib1 = elem1.Attributes["Attribute1"];
object val = attrib1.PIPoint.Snapshot().Value;
object val2 = attrib1.Attributes["Attribute1"].PIPoint.Snapshot().Value;
Please tell me if you are doing anything different than this. If you cannot see any difference, perhaps try my code and see if you see same behavior.
Rick: Legacy reasons I guess, haven't been looking into why, I have just used the code. But - that said - if I use afattribute.GetValue().Value i am getting the correct value (and if i switch back to afattribute.PIPoint.Snapshot().Value i'm still getting the child attributes value..... strange!)
Could you please provide us a procedure creating an AF database from scratch in order to reproduce the issue? You can create a database with one element, one attribute and some child attributes referring to the sinusoid and cdt158 PI Points. Unfortunately, it would be difficult for us to help you if we cannot reproduce it. You can also export the database information to a XML file using PI System Explorer.
I've done some investigations with the steps asked for by Jason - and i could't reproduce the error on any other data myself. When i've checked the data from the attribute and child-attributes it all comes down to some weird mapped UOM's on the attributes and some numbers happens to be the same which caused the confusion. The data read when used PIPoint.Snapshot().Value is correct, but are mapped with different UOM in AF which gave me another number when using just GetValue().Value ...
Sorry for the trouble!
That is great news. Glad you figured it out.