AddItem Method
Description
Creates a new item object.
Syntax
Visual Basic
Public Function AddItem( _
   ByVal ItemData As Variant _
) As Object
Parameters
ItemData

There are two options for ItemData:

  • Null. Initially creating a virtual object with Null ensures that you cannot then Post until all required fields are initialized.
  • An array consisting of the following elements:

(0) Type - The condition type (long, required).  1 for run or 2 for time.

(1) Source - For a run condition, the source condition ID (long). For a time condition, the date-time string. (required) 

(2) Target - The target condition ID (long, required).

(3) Value - The condition value. (required). For a time condition, the date-time string. For a run condition, either TDCOND_PASSED  or TDCOND_FAILED.

(4) Desc - A description of the condition (string, optional).

Return Type
Remarks

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.

See Also