Storing data in PI with PIPoint.UpdateValue([afvalue], AFUpdateOption.NoReplace) generates errors in PI message log

Discussion created by vegard on Oct 25, 2013
Latest reply on Oct 25, 2013 by Gregor

I have created an application that writes data to some PI points using the AFSDK. As the values being pushed to PI are gathered from a data source that is being updated periodically and which handles timpstamping of the values itself, I occasionally collect and push some data that have already been stored in PI at an earlier scan cycle. As such, I am using PIPoint.UpdateValue() using the following method: PIPoint.UpdateValue(theNewAFValue, AFUpdateOption.NoReplace). As the AFSDK states, the AFUpdateOption.NoReplace instruction will disregard the value from being stored if the value already exists.


However, when I have tested this application, I have noticed that it at times generate entries in the PI message log titled "Postevent failed: [-109] Value at This Time Already Exists" and "PIarcmgr::addevent failed, mode: 0 ptid: 19409 recid: 0 status: [-109] Value at This Time Already Exists". Preferably, I want the PI server to handle the ignoring of new data in case it already exists at a given timestamp. Is this possible to achieve without adding entries in the PI message log?


One way of achieving it would be to send a query to the PI server before pushing the data, where I asked to check if a value for a given timestamp exists.. Is this the preferred way of handling this?