Previous Topic: Accessing a Specific ObjectNext Topic: Filtering Object Collections


ISCModelObjectCollection Interface

The following table contains information on the ISCModelObjectCollection interface:

Signature

Description

Valid Arguments

ISCModelObject * Item(VARIANT nIndex, VARIANT Class [optional])

Returns an IUnknown pointer for a Model Object component identified by the nIndex parameter

nIndex:

  • VT_UNKNOWN – Pointer to the ISCModelObject interface. Given object is returned from the collection.
  • VT_BSTR – ID of an object. The object with the given identifier is returned from the collection.
  • VT_BSTR – Name of an object. If the name of an object is used, the Class parameter must also be used. The object with the given name and given Class type is returned from the collection.

Class:

  • Empty – The object specified by nIndex is returned from the collection.
  • VT_BSTR – Name of a class. Must be used if the nIndex parameter is the name of an object. Returns the object with the given name and given Class.
  • VT_BSTR – Class ID of object type. Must be used if the nIndex parameter is the name of an object. Returns the object with the given name and given Class identifier.

Note: For information about valid object class names and identifiers, see the HTML document ERwin Metamodel Reference, in the Metamodel Reference Bookshelf located in the CA ERwin Data Modeler installation folder.

Example 9

The following example illustrates how to access a specific object using C++. The example uses a Session object from Example 6:

void GetObject(ISCSessionPtr & scSessionPtr, CString & csID)
{   
    ISCModelObjectCollectionPtr scModelObjColPtr = scSessionPtr->GetModelObjects();
    ISCModelObjectPtr scObjPtr = scModelObjColPtr->GetItem(COleVariant(csID));
    // … 
}

The following example illustrates how to access a specific object using Visual Basic .NET. The example uses a Session object from Example 6:

Public Sub GetObject(ByRef scSession As SCAPI.Session, ByRef objID As String)
    Dim scObjCol as SCAPI.ModelObjects
    Dim scObj as SCAPI.ModelObject
    
    scObjCol = scSession.ModelObjects
    scObj = scObjCol.Item(objID)  ' retrieves object with given object ID
End Sub