BlueCielo Meridian Enterprise 2012 Developer's Guide | BlueCielo ECM Solutions

Working with variant values

Meridian Enterprise API methods that return a property value use the Variant data type. This allows them to return any of the possible data types. You can also use Variant variables in your code to hold values of any data type.

Another reason to use Variant variables is to recognize properties without a value. Not all objects in the database will have a value for all properties. If a property has no value, then the server will return the variant value Null for that property.

Visual Basic will raise an error if you attempt to assign the value Null to a regular variable (like a String) as shown in the example below. Only variants can have the value Null.

Dim title as String
title = m_Designer.GetPropertyValue ("", "Title_BSTR") 'Error : 'Invalid use of  Null'

You could design your code to use a default value for properties that do not have a value, as in the following example:

Dim title as Variant
title = m_Designer.GetPropertyValue ( "", "Title_BSTR" )
If IsNull(title) Then
    ' No value for title available
    title = "Default Title"
End If

Or use the same functionality in a single call, as in this example:

Dim title as String
title = m_Designer.GetPropertyValue ("", "Title_BSTR",  "Default Title")

Note    An empty string (zero length) is technically a valid string value. But when the user clears a text property on a Meridian Enterprise property page, the client will save the field as Null, not as an empty string.

Copyright © 2000-2012 BlueCielo ECM Solutions