Goodtech

PIPoint.UpdateValues doesn't add values

Discussion created by Goodtech on Mar 20, 2014
Latest reply on Mar 20, 2014 by Gregor

I have a tag with a set of test values that I want to write to the PI server using the AF SDK. The idea is to do the following:

 

1) Connect
2) Create the PIPoint
3) Insert values into the PIPoint
4) Do some queries
5) Delete the PIPoint 

 

So far, 1,2 and 5 are working perfectly, but when I try to use UdateValues in step 3, nothing happens.

 

Here's a simplified version of the code: 

 
                    IList<AFValue> afValues = new List<AFValue>();

                    foreach (var tagRecord in tag.TagRecords)
                    {
                        AFValue afv = new AFValue();

                        afv.Value = tagRecord.Value;
                        afv.Timestamp = new AFTime(tagRecord.InputTimeUtc);
                        afv.IsGood = tagRecord.Quality.IsGood();
                        afv.PIPoint = piPoint;

                        afValues.Add(afv);
                    }

                    var errors = piPoint.UpdateValues(afValues, AFUpdateOption.Insert);

When I debug, the IList afValues has all the AFValues that I want added, with correct properties. The errors object is null, indicating that there were no errors trying to run UpdateValues, but when I look at the tag in PI SMT, there are no values for the tag. I've tried with various AFUpdateOptions, but neither of them have worked.

 

The PiPoint is created using CreatePIPoints with a list of pointNames (containing only one item).

Outcomes