Hi there,
I'm trying to add an Annotation into PIValue using PI SDK in C#. I've run some existing examples in VB and they are working. Now trying to do same in C# (I have to use C#).
Here is a code sample I'm trying with.
I'm having exception error on line 14 saying "Unable to add to a PIValues collection. Failed to clone ValueAttribute"
If I comment line 13 everything works fine, but there is no annotations in PIValue.
Line 13 doesn't compile if it's like "myVal.ValueAttributes.Add("annotations", ref myAnns);"
1. Server myServer;
2. PIPoint testTag;
3. PIAnnotationsClass myAnns = new PIAnnotationsClass();
4. PIValue myVal = new PIValue();
5. PITime valTim = new PITime();
6. myServer = oSDK.Servers["MYPIServer"];
7. testTag = myServer.PIPoints["SINUSOID"];
8. myAnns.Add("IntegerAnn", "Integer annotation", 1, false, "Integer");
9. valTim.SetToCurrent();
10. myVal.Value = valTim.UTCSeconds;
11. myVal.TimeStamp = valTim;
12. object objValue = myAnns;
13. myVal.ValueAttributes.Add("annotations", ref objValue);
14. testTag.Data.UpdateValue(myVal, valTim, DataMergeConstants.dmReplaceDuplicates, null);
Suggestions?
Thanks
Djuro