AnsweredAssumed Answered

aflistdata.updatevalues() does not update every AFValue in the List<AFValue> passed into the method.  No errors are returned.

Question asked by mcgilvrey on Oct 15, 2015
Latest reply on Oct 15, 2015 by mcgilvrey

The attributes owning the afvalues have data references that are PIPoints.

When I check the time series data in System Explorer, some of the values are missing.

Here is a code snippet:

 

/* code in a test console app using test attributes

* AFElements on an AFDatabase with attributes that use PIPoints

**/

var test1 = database.Elements["test1"];

var test2 = database.Elements["test2"];

var rand = new Random();

var vals = new List<AFValue>();

for(int i = 0; i < 10; i ++)

{

     vals.Add(new AFValue(test1.Attributes["testAttribute"], i + rand.NextDouble(), AFTime.Now));

     vals.Add(new AFValue(test2.Attributes["testAttribute"], i + rand.NextDouble(), AFTime.Now));

     Thread.Sleep(1000);

}

var errors = AFListData.UpdateValues(vals, AFUpdateOption.Replace);

if(errors != null && errors.HasErrors)

{

     if(errors.Errors != null && errors.Errors.Count > 0)

     {

          foreach (var x in errors.Errors)

          {

               Console.WriteLine(" AFValue '{0}': {1}", x.Key, x.Value);

          }

     }

}

Outcomes