cleroux

In AFSDK UpdateValue cannot use Replace from AFUpdateOption

Discussion created by cleroux on Oct 15, 2014
Latest reply on Oct 16, 2014 by cleroux

Hey guys,

 

Using latest versions (2014 R2), when calling UpdateValue using the Replace option from the AFUpdateOption enumeration, I am not able to replace any values (and therefore set the substitution peramater). I just don't see any reaction in the archive, as if the call was ignored. When I step into debug, the call goes through like any others. All other AFUpdateOption work using the same exact code. I can even remove the value using the Remove option too using the same code. I tried to remove and then insert, that works but the substitution flag is not set so this is not good.

 

Did someone use this "Replace" mode successfully?

 

Thanks!

 

Simple code I use:

 

 

 
    Private Sub MyCalc(ByVal alist As AFAttributeList, ByVal t As AFTime)

        Dim vs As AFValues

        'Read the values from the attributes part of alist using the GetValue() call. 
        vs = alist.GetValue(t)

        Dim badCount As Integer = 0

        For j As Integer = 0 To alist.Count - 1
            Dim v As AFValue = vs.Item(j)
            If v.IsGood Then
                'Write the values back to the corresponding PIPoint DR attribute
                alist.Item(j).Data.UpdateValue(v, Data.AFUpdateOption.Replace)
            Else
                badCount = badCount + 1
            End If
        Next j

    End Sub

 

Outcomes