Open topic with navigation
Public Function AddItem( _ ByVal ItemData As Variant _ ) As Object
Pass Null if you intend to save the TestSet to the database. You cannot then Post until the required fields are initialized. See the example below.
You can use other options to create a temporary object, for example, to populate a list for display. You cannot Post a TestSet created this way. The ItemData options for creating temporary objects are:
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.
Dim myTestSetFolder As TestSetFolder ' ... get TestSetFolder ' .... Dim tsFact As TestSetFactory Set tsFact = myTestSetFolder.TestSetFactory Set testSet1 = tsFact.AddItem(Null) testSet1.Name = "myTestSet" testSet1.Status = "Open" testSet1.Post