Scripting > mrScriptMetadata User's Guide > Working with mrScriptMetadata in MDM Explorer
 
Working with mrScriptMetadata in MDM Explorer
Metadata Model (MDM) objects that represent questions and other main structural items (such as variables, blocks, grids, compounds, and loops) have a Script property. This is a read-write property that displays an mrScriptMetadata representation of the object and enables you to change the object by changing the mrScriptMetadata. Although this is a standard property, MDM Explorer shows the contents of this property in a pane in the lower right corner of the MDM Explorer window. This makes it easy to view and change the mrScriptMetadata without the need for a separate script editor and is a great tool for learning mrScriptMetadata. This topic provides instructions to get you started.
To start MDM Explorer and open the Household sample metadata document (.mdd) file
1 In Windows Explorer, browse to the folder where MDM Explorer was installed.
x86 32-bit installations:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Code\Tools\VB6\MDM_Explorer
x64 64-bit installations:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Code\Tools\VB.NET\MDM_Explorer
2 Double-click MDM Explorer.exe. This opens the MDM Explorer window.
3 From the File menu in MDM Explorer, choose Open Document.
4 In the Open Metadata File dialog box, browse to the folder where the Household sample .s file was installed. Typically this is:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Data\Data Collection File\
5 Double-click Household.mdd.
To view the mrScriptMetadata that represents the entire MDM Document
1 Click the Document object on the left side of the MDM Explorer window. This displays the contents of the Document.Script property in the lower left corner of the window.
The script includes Metadata and End Metadata tags, and that the default language, ENU (which is English United States) is specified in the Metadata tag.
ENU is also selected in the bar at the bottom of the Script pane.
2 In the bar at the bottom of the Script pane, select ESN to switch to Spanish. Notice that ESN is now specified in the Metadata tag in the script.
3 Select ENU to switch back to English.
To view the script that represents a question, loop, grid, or other structural object
1 Click the Fields folder below the Document object. This opens the folder and displays the questions that are nested inside.
2 Select the object whose script you want to view. This displays the contents of the object's Script property in the lower left corner of the window.
Note that the script does not include Metadata and End Metadata tags, because it is a “scriptlet” (which means that it does not represent a whole Document). The Metadata and End Metadata tags are included in the script only when it represents the entire Document.
Some of the objects, such as Grid, Array (loop), Compound, and Class (block) objects, contain nested Fields folders. You can open these and select the objects nested inside, to view their mrScriptMetadata representation.
To add a new question using the AddScript method
1 On the left side of the window, select the Fields folder in which you want to insert the new question.
2 From the Methods menu, choose Add Script.
3 In the text box that opens, enter the mrScriptMetadata that represents the question, and then click OK.
Provided the script you entered is valid, this adds the new question to the selected folder. MDM Explorer will display a message if you have made a syntax error. The message generally provides a line number to indicate where the error occurred, and this should help you track down the problem.
You can use the AddScript method to add objects to the following folders:
Fields. These represent a Fields collection object and store questions and other questionnaire items. You cannot add a defined list to this type of collection.
Types. These represent a Types collection object and store reusable templates. You can use the AddScript method to add to the Types collections only mrScriptMetadata containing defined lists (using the define keyword).
HelperFields. These represent a HelperFields collection object and store helper variables.
See also
mrScriptMetadata files
Sample mrScriptMetadata files in the DDL
mrScriptMetadata reference
mrScriptMetadata User's Guide