ISCModelProperty Interface

The following table contains information on the ISCModelProperty interface:

Signature

Description

Valid Arguments

long Count()

Contains the number of values in the property.

For scalar properties, the number of values in the property is always one.

It is possible to have a non-scalar property with no elements. In this case, the number of values in the property will be zero.

None

SC_ModelPropertyFlags Flags()

Returns the flags of the property.

None

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

Retrieves the indicated property value in the requested format.

ValueId:

  • Empty � Valid for a scalar property only.
  • VT_I4 � Zero-based index within a homogeneous array. The value of the member indicated by this index is returned.

ValueType:

  • Empty � Indicates a native datatype for a return value.
  • SCVT_DEFAULT � Indicates a native datatype for a returned value.
  • SCVT_BSTR � Requests conversion to a string for a returned value.

More information about SC_ModelPropertyFlags is located in the Enumerations section. More information about property datatypes is located in the SC_ValueTypes section.

Example 14

The following example illustrates how to access scalar property values using C++. The example uses a Model Property object from Example 13:

void GetScalarProperty(ISCModelPropertyPtr & scObjPropPtr)
{   
    if (scObjPropPtr->GetCount() <= 1)
    {  
       _bstr_t bstrPropVal= scObjPropPtr->FormatAsString();
       // …
    }
}

The following example illustrates how to access scalar property values using Visual Basic .NET. The example uses a Model Property object from Example 13:

Public Sub GetPropertyElement(ByRef scObjProp As SCAPI.ModelProperty)
      If (scObjProp.Flags And SCAPI.SC_ModelPropertyFlags.SCD_MPF_NULL) Then  
         Console.WriteLine( "The value is Null" )
      Else
        If (scObjProp.Flags And SCAPI.SC_ModelPropertyFlags.SCD_MPF_SCALAR) Then
              Console.WriteLine( scObjProp.Value.ToString() )
        Else
               For j = 0 To scObjProp.Count-1
          	   Console.WriteLine( scObjProp.Value(j).ToString() )
               Next
        End If
      End If
End Sub