PIModuleDB and EventPipe

Discussion created by Bannikov on Jan 15, 2010
Latest reply on Jan 15, 2010 by spilon

Hello All!


I've just tried to implement EventPipe OnNewValue handler. My task wask to catch all changes in MDB during COMTRADE file importing (with help of SISCO Comtrade Utility). I've sucessfully catched all events, but have found that I can't utilize this information -- all what I've catched, is Module that was changed. I've absolutely know that Module itself isn't changed during this process, but new PI Propertries are added to Module. I've hoped that I can figure out, which Properties has beed added to module, but I can't extract this information from PIEventObject object. My handler looks lite that (see below).


I've receivied ten or more identical events, each says that the same PIModule has been changed, but I can't figure it out, which Property (or maybe Alias) was changed. Maybe it's another way to retrieve this information? Thank you!

Private Sub ModuleDBUpdateHandler()
    Dim IPGR As PISDK.IPIGlobalRestorer
    Dim restorer As PISDKCommon.PIGlobalRestorer
    Dim e As PISDK.PIEventObject
    Dim m As PISDK.PIModule

    MessageLog(String.Format("AceComtradeClass.ModuleDBUpdateHandler: {0} events in queue", mdbEvents.Count))

    ' Create a restorer
    IPGR = sdk
    restorer = IPGR.Restorer

    ' while queue isn't empty
    While mdbEvents.Count > 0
        ' Retrieve next event
        e = mdbEvents.Take
        ' Restore module
        m = restorer.RestoreObject(e.PassivationString)

        MessageLog(String.Format("AceComtradeClass.ModuleDBUpdateHandler: {0} '{1}'", e.Action.ToString, m.Name))

        ' Process NamedValue
        For Each nv As PISDKCommon.NamedValue In e.EventData
            MessageLog(String.Format("AceComtradeClass.ModuleDBUpdateHandler: {0} := {1}", nv.Name, nv.Value.ToString))
    End While
End Sub