Previous Topic: Setting Scalar Property Values

Next Topic: Setting Non-Scalar Property Values

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:

  • Empty – Not used when setting scalar properties.

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 r8 directory.

Example 21

The following example illustrates how to set 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 & csName) 
{   
    ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProperties();
    CString csPropName = "Name";
    ISCModelPropertyPtr nameProp = propColPtr >  GetItem(COleVariant(csPropName));
    if (nameProp != NULL)
       nameProp->PutValue(vtMissing, (long) SCVT_BSTR, csName);
}

The following example illustrates how to set 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”)
    modelProp.Value = val
End Sub