IRunFactory Interface : AddItem Method |
Visual Basic |
---|
Public Function AddItem( _ ByVal ItemData As Variant _ ) As Object |
Always set a status when creating a new run:
Set NewRun = RunF.AddItem(Null)
NewRun.Status = "No Run"
NewRun.Name = "run 01"
NewRun.Post
Following a call to AddItem with an array of parameters, the Run table field RN_PATH contains the value from the array(2), if it was passed. If array(2) was an empty string (""), then field RN_PATH contains "a_b" where "a" is the RN_CYCLE_ID and "b" is the RN_RUN_ID. Field RN_HOST is always empty following a call AddItem.
Passing NULL as the ItemData argument creates a virtual object, one that does not appear in the project database. After creating the item, use the relevant object properties to fill the object, then use the Post method to save the object in the database.
This is the recommended technique for creating most objects that will be saved in the database. Exceptions are noted where appropriate in the specific factory object descriptions.
You can also pass an ItemData argument identifying the item to be added. When this syntax is used, no check is performed on whether all required fields have been initialized. This is safe when the item is never going to be added to the database, as in populating a list for display.