You can update a DUOS data object when window field values change. In this example, the procedure updates a data object’s properties, and adds a property named “Date Changed”:
Dim ItemCollection As DUOSObjects Dim ItemObject As DUOSObject Set ItemCollection = DUOSObjectsGet("Additional Item Info") Set ItemObject = ItemCollection.Item("ITM002") 'Set property values from window fields for this object ItemObject.Properties.Item("Item Weight") = ItemWeight ItemObject.Properties.Item("Item Color") = ItemColor 'Set the date changed property to the VBA system date ItemObject.Properties.Item("Date Changed") = Date
You can also globally update DUOS data objects by looping through each object in the collection. In this example, the For...Next statement in VBA checks the Item Color property for each item in the ItemCollection. If the value is Red, the collection’s Remove method deletes the object:
Dim ItemCollection As DUOSObjects Dim ItemObject As DUOSObject Set ItemCollection = DUOSObjectsGet("Additional Item Info") For Each ItemObject In ItemCollection If ItemObject.Properties.Item("Item Color") = "Red" Then 'Delete the object ItemCollection.Remove(ItemObject.ID) End If Next