ISCModelObject Interface

The following table contains information on the ISCModelObject interface:

Signature

Description

Valid Arguments

ISCModelPropertyCollection * CollectProperties(VARIANT ClassIds [optional], VARIANT MustBeOn [optional], VARIANT MustBeOff [optional])

Returns a property collection of the type that you require

ClassIds:

  • Empty � All properties of the object are returned.
  • VT_ARRAY|VT_BSTR � SAFEARRAY of property class IDs. Returns the properties with the given property class identifiers.
  • VT_ARRAY|VT_BSTR � SAFEARRAY of property names. Returns the properties with the given class names.
  • VT_BSTR � ID of a property class. Returns the property with the given property class identifier.
  • VT_BSTR � Name of a property. Returns the property with the given class name.
  • VT_BSTR � List of property class IDs delimited by semicolons. Returns the properties with the given property class identifiers.
  • VT_BSTR � List of property names delimited by semicolons. Returns the properties with the given class names.

MustBeOn:

  • Empty � Defaults to SCD_MPF_DONT_CARE and returns all properties.
  • VT_I4 � SC_ModelObjectFlags flags that must be on. Returns the properties with the specified flags set.

MustBeOff:

  • Empty � Defaults to SCD_MPF_NULL and returns all properties.
  • VT_I4 � SC_ModelObjectFlags flags that must be off. Returns the properties that do not have the specified flags set.

Setting certain filter criteria can influence the effectiveness of data retrieving. For example, setting the MustBeOn filter to SCD_MPF_DERIVED builds a collection with only the calculated and derived properties. Requests to evaluate the calculated and derived properties will reduce performance while iterating over the collection. However, setting the MustBeOff filter to the same value, SCD_MPF_DERIVED, which excludes the calculated and derived properties, improves performance.

Example 17

The following example illustrates how to filter properties using C++. The example uses a Model Object object from Example 9:

void GetProperties(ISCModelObjectPtr & scObjPtr)
{    
     
    ISCModelPropertyCollectionPtr propColPtr;
    
    propColPtr = scObjPtr->GetProperties();    // no filtering
    
    VARIANT valFlags;
    V_VT(&valFlags) = VT_I4;
    V_I4(&valFlags) = SCD_MPF_SCALAR;
    
    propColPtr = scObjPtr->CollectProperties(vtMissing, valFlags, vtMissing);  //  scalar properties only
    propColPtr = scObjPtr->CollectProperties(vtMissing, vtMissing, valType);  // non-scalar properties only
}

The following example illustrates how to filter properties using Visual Basic .NET. The example uses a Model Object object from Example 9:

Public Sub( ByRef scObj As SCAPI.ModelObject )
    Dim scObjProperties As SCAPI.ModelProperties
    
    scObjProperties = scObj.Properties   ' no filtering
    
    scObjProperties = scObj.CollectProperties(, SCD_MPF_SCALAR)  ' scalar properties only
    
    scObjProperties = scObj.CollectProperties(, , SCD_MPF_SCALAR)  ' non-scalar properties only
End Sub