ISCModelProperty Interface

The following table contains information on the ISCModelProperty interface:

Signature

Description

Valid Arguments

void Value(VARIANT ValueId [optional], VARIANT ValueType [optional], VARIANT Val )

Sets the indicated property value with the given value

ValueId:

  • VT_I4 � Index for a non-scalar property of which the given value is set.
  • VT_BSTR � Name of a member in a non-scalar property of which the given value is set.

ValueType:

  • Empty � Not used.

Val:

  • Dependent upon the property type.

Note: For information about valid property values, see the HTML document erwin Metamodel Reference, in the Metamodel Reference Bookshelf located in the erwin� Data Modeler installation folder.

Example 22

The following example illustrates how to set non-scalar property values using C++. The example uses a Model Object object from Example 9 and assumes that a transaction has opened:

// NOTE: ISCSession::BeginTransaction() must be called prior to calling this 
// function
// ISCSession::CommitTransaction() must be called upon returning from this 
// function
void SetNameProperty(ISCModelObjectPtr & scObjPtr, CString & csValue) 
{   
    ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProperties();
    CString csPropName = "Non-Scalar";
ISCModelPropertyPtr nameProp = propColPtr >  GetItem(COleVariant(csPropName));
    if (nameProp != NULL)
    // Setting the first element
    nameProp->PutValue(COleVariant(0L), (long) SCVT_BSTR, csValue); 
}

The following example illustrates how to set non-scalar property values using Visual Basic .NET. The example uses a Model Object object from Example 9 and assumes that a transaction has opened:

' NOTE: ISCSession::BeginTransaction() must be called prior to calling this function
' ISCSession::CommitTransaction() must be called upon returning from this function
Public Sub SetScalarPropValue(ByRef scObj As SCAPI.ModelObject, ByRef val As Variant)
    Dim modelProp As SCAPI.ModelProperty
    modelProp = scObj.Properties(�Name�)
    Dim index As Long
    Index = 0     ' Setting index to zero
    modelProp.Value(index) = val   ' index is used to access non-scalar property
End Sub