Return to Introduction  Previous page  Next page

public Class

This is the main collection class used by all elements within the Automation Interface. It contains methods to iterate through the collection, refresh the collection and delete an item from the collection. It is important to realize that when AddNew is called, the item is not automatically added to the current collection. The typical steps are:

1.Call AddNew to add a new item.
2.Modify the item as required.
3.Call Update on the item to save it to the database.
4.Call Refresh on the collection to include it in the current set.

Delete is much the same; until Refresh is called, the collection still contains a reference to the deleted item, which should not be called.

For each, can be used to iterate through the collection for languages that support this type of construct.

Collection Attributes






Read only.  The number of objects referenced by this list.



Read only.  Distinguishes objects referenced through a Dispatch interface.

Collection Methods




GetAt (short) 


param: index [ short - in ]

Retrieves the array object using a numerical index.  If the index is out of bounds, an error occurs.

Delete (short) 


param: index [ short - in ]

Deletes the item at the selected reference.

DeleteAt (short, Boolean) 


param: index [ short - in ]

param: refresh [ Boolean - in ]

Deletes the item at the selected index. The second parameter is currently unused.

GetLastError () 


Returns a string value describing the most recent error that occurred in relation to this object.

This function is rarely used since an exception is thrown when an error occurs.

GetByName (String) 


param: Name [ String- in ]

Gets an item in the current collection by Name. Only applies to the following collections: Models, Packages, Elements, Diagrams, TaggedValues. 

Refresh () 


Refreshes the collection by re-querying the model and reloading the collection. Should be called after adding a new item or after deleting an item.

AddNew (String, String) 


param: Type [ String - in ]

param: Name [ String - in ]

Adds a new item to the current collection. Note that the interface is the same for all collections; you must provide a Name and Type argument. What these are used for depends on the actual collection member.  Also note that you must call Update() on the returned object to complete the AddNew. If Update() is not called the object is left in an indeterminate state.