ISCPropertyValue Interface

The following table contains information on the ISCPropertyValue interface:

Signature

Description

Valid Arguments

VARIANT ValueId(VARIANT ValueType [optional])

Uniquely identifies the value in a non-scalar property.

ValueType:

  • SCVT_I2 � If the property is non-scalar, the value of the property index is returned.
  • SCVT_I4 � If the property is non-scalar, the value of the property index is returned.

  • SCVT_BSTR � The name of the non-scalar property member if it is available, or else the index of the member is returned.
  • SCVT_DEFAULT � If the property is non-scalar, the value of the property index is returned.
  • Empty � Defaults to SCVT_DEFAULT.

SC_CLSID PropertyClassId()

Returns the class identifier of the current property

None

BSTR PropertyClassName()

Returns the class name of the current property

None

VARIANT Value(VARIANT ValueType [optional])

Converts the current value to the passed value type.

ValueType:

  • SCVT_DEFAULT � Indicates a value in the native format.
  • SCVT_BSTR � String representation of the property value.
  • Target Type � Identifies a target for a type conversion.
  • Empty � Defaults to SCVT_DEFAULT.

SC_ValueTypes ValueType()

Passes back the identifier of the value default type

None

SC_ValueTypes ValueIdType()

Passes back the identifier of the value identifier default type

None

SC_ValueTypes * GetSupportedValueTypes()

Groups a list of supported value types and returns it as a SAFEARRAY

None

SC_ValueTypes * GetSupportedValueIdTypes()

Groups a list of supported value types for the current value identifier and returns it as a SAFEARRAY

None

More information about value datatypes is located in the SC_ValueTypes section.

Example 15

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

void IterateNonScalarProperties(ISCModelPropertyPtr & scObjPropPtr)
{
   if (scObjPropPtr->GetCount() > 1)
   {
     ISCPropertyValueCollectionPtr propVals = scObjPropPtr->GetPropertyValues();
     long numVals = propVals->GetCount();
     for (long i = 0; i < numVals; i++) 
     {
         ISCPropertyValuePtr propValPtr = propVals->GetItem(COleVariant(i));
         VARIANT valType;
         V_VT(&valType) = VT_I4;
         V_I4(&valType) = SCVT_BSTR;
         bstr_t bstrPropVal = propValPtr->GetValue(valType);
         // …
     }
   }
}

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

Public Sub IterateNonScalarProperties(ByRef scObjProp As SCAPI.ModelProperty)
    Dim scPropValue as SCAPI.PropertyValue
    
    If (scObjProp.Count > 1) Then
       For Each scPropValue In scObjProp.PropertyValues
       	If (scPropValue.ValueIdType = SCVT_BSTR) Then
       	   Console.WriteLine( scPropValue.ValueId(SCVT_BSTR),": ", _
               scPropValue.Value.ToString())
       	Else
                Console.WriteLine (scPropValue.Value.ToString())
        	End If
       Next
    End If
End Sub