Scripting > UNICOM Intelligence Function Library > Miscellaneous functions > GetInterface
 
GetInterface
Returns an alternate interface for an object.
Syntax
GetInterface(Object, InterfaceID)
Parameters
Object
Type: Object
The object to query for the alternate interface.
InterfaceID
Type: String
The identifier of the interface as a string. This is a string representation of the Interface ID in the form {xxxxxx-...-xxxx}
(return)
Type: Object
The alternate interface for the object.
Remarks
An error is returned if the object does not support the requested interface.
The results may be unpredictable if the alternate interface does not derive from IDispatch.
Example
The following mrScriptBasic example uses the GetInterface function to return the IArray interface for an MDM Grid object:
Dim MyDocument, MyObject, MyCategory
Set MyDocument = CreateObject("MDM.Document")

MyDocument.Open("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\MDD\short_drinks.mdd", , _
MDMLib.openConstants.oREAD)

' Get the IArray interface for the Grid object named childhhz...

Set MyObject = MyDocument.Fields["childhhz"].GetInterface( _
"{7A17758A-8D4F-4c5d-A9D8-D4CF574D9B14}")

' The Grid object can now be treated as an Array object. For
' example, the IArray.Categories property can be used to
' loop through all the categories of the Grid object...

For Each MyCategory In MyObject.Categories
Debug.Log(MyCategory.Name)
Next
Here is the output:
YEARS_0_5
YEARS_6_10
YEARS_11_15
See Using the clone feature for another example script that uses the GetInterface function.
See also
Miscellaneous functions