To create a DUOS data object, use the DUOS global DUOSObjectsGet method to specify a collection. If the collection doesn’t exist, this method creates it. The following example specifies a collection named “Additional Item Info.”
The example then uses the collection’s Item property to assign a unique ID to the data object (ITM002). If an object with that ID already exists, the Item property specifies an existing object in the collection with that ID. Finally, this example creates two new properties for the data object using the DUOSObjects collection’s Item property, and assigns values to each:
Dim ItemCollection As DUOSObjects Dim ItemObject As DUOSObject 'Specify the collection Set ItemCollection = DUOSObjectsGet("Additional Item Info") 'Specify an object in the collection with a unique object ID Set ItemObject = ItemCollection.Item("ITM002") 'Create properties and property values for this object ItemObject.Properties.Item("Item Weight") = "3.5" ItemObject.Properties.Item("Item Color") = "Red"
If you’re storing values entered from window fields (either in a Microsoft Dynamics GP window or from a VBA user form), set the object’s property values to the values of the window fields. A portion of the previous example would then look like this:
'Set the object ID using the ItemID field Set ItemObject = ItemCollection.Item(ItemID) 'Set property values using two window fields ItemObject.Properties.Item("Item Weight") = ItemWeight ItemObject.Properties.Item("Item Color") = ItemColor