Professional > Getting started with UNICOM Intelligence Professional > Creating an instance of an MDM Document object
 
Creating an instance of an MDM Document object
Next, you create an instance of an MDM Document object.
1 Click the Functions tab to bring the Functions pane to the front, and then expand the Misc folder.
2 Right-click the CreateObject function, and then click Add Function.
This inserts the name of the function into the script.
3 Type an opening parenthesis:
(
This displays the function’s syntax, which shows that there is one parameter (the class) and that the function returns an object.
4 Type the parameter and the closing parenthesis:
"MDM.Document")
UNICOM Intelligence Professional automatically highlights the parentheses so that you can see the opening and closing pair, and colors the text to distinguish the different elements of the script. For example, different colors are used for keywords, variables, and literals.
5 On the next line type:
MDM.
(including the dot)
This activates the ScriptAssist autosuggest feature: a list appears showing the object's properties and methods.
6 Double-click the Open method.
This inserts the method into the script.
7 Type the opening parenthesis:
(
This displays the method's parameters. (This is called the autosignature.) The parameter that you are on is in bold; you will use this parameter to specify the .mdd file to be opened. Optional parameters are shown in square brackets.
8 Type the name and location of the Short Drinks sample .mdd file. Because this is a text argument, you must enclose it in quotation marks:
MDM.Open("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Data\Mdd\short_drinks.mdd")
9 Click the Types tab to bring the Types pane to the front.
The Types pane is similar to the Visual Basic object browser. It shows the properties and methods of all of the default objects. When you use the CreateObject function to create an instance of a UNICOM Intelligence Data Model or UNICOM Intelligence object, the Types pane also lists the objects in the associated type library. We created an MDM object from the MDM type library, which is called MDMLib.
10 Select MDMLib from the first list in the top left corner of the pane.
This restricts the list to the objects in the MDM type library.
There are tools on the Types pane toolbar that you can use to search and sort the list of objects and the list of an object's members. When you select an object on the left side of the pane, its members are shown on the right. When you click a property or method, the lower part of the pane shows its syntax and other useful information (such as whether it is a read-only or read-write property) and when you click a constant, its value is shown. The Types pane has a shortcut menu, like the Functions pane: right-clicking a member (such as a property or method) opens a shortcut menu, which enables you to insert the property or method into the code.
Next
Working with a common Microsoft object
See also
Getting started with UNICOM Intelligence Professional