Sample mrScriptBasic files
The UNICOM Intelligence Developer Documentation Library comes with a number of sample mrScriptBasic files. By default, these are installed into the [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\General\mrScriptBasic folder.
Some of the sample files reference sample data files. If the sample data files are stored in a different location on your computer, you will need to edit the sample mrScriptBasic files accordingly before running them. You should also check that any filenames, and file and folder locations that are referred to in the samples are correct for your system and if necessary edit the samples accordingly.
To run these samples, you need UNICOM Intelligence Data Model 3.0 or later. Some of the samples have additional requirements. For example, the samples whose names begin with "MS" need one or more Microsoft Office applications.
The mrScriptBasic sample files are:
AddSourceFileVariablesToMDD.mrs
Use this script to add SourceFile helper variables to a metadata document (.mdd) file so that you can use the .mdd file with UNICOM Intelligence Interviewer - Paper/Scan Add-on. A SourceFile variable is typically used to store the location of a .tiff file that contains a scanned image of a hand written response.
AppointmentDistribution.mrs
Used in conjunction with TestCATIReport.mrs and AppointmentDistribution.mdd to mimics the Interviewing activity.
CdscHdataTransfer.mrs
This sample can be used to transfer hierarchical data from one CDSC that supports
HDATA to another. For example, you can use this script to transfer data from a Relational MR Database or a Quanvert levels project to a UNICOM Intelligence Data (.
ddf) file. The script runs directly against the CDSC interface because
HDATA write support has not yet been added to the . For more information, see
Creating HDATA-enabled XML files.
CompareTwoMDDFiles.mrs
Use this script to compare two metadata document (.mdd) files. The script first compares the Language, Context, and Version collections. It then compares each unique combination of Language, Context, and Version by comparing the mrScriptMetadata scripts for each combination. All mismatches are written to the log. If there is a mismatch in one or more of the mrScriptMetadata scripts, those scripts are written to .txt files in the same folders as the .mdd files. Before running this script, you must edit it to specify the .mdd files that will be compared.
CompareVersions.mrs
This can be used to do a limited comparison of two or more versions of the metadata. The comparison is designed to detect whether the version changes mean that cases collected using one or more versions can be safely exported using another (typically later) version. At the top of the sample you specify the metadata file to be used and two or more of its major versions to be the "case data" versions and one version to be the "metadata" version. Categories and variables that appear in the designated "case data" versions but not the "metadata" version are listed on the screen. For more information, see
Listing and comparing versions.
CreateArrays.mrs
This is a mrScriptBasic version of the Visual Basic example shown in
Hierarchical data in the MDM.
CreateDBArrayQuestions.mrs
Defines a database array from responses that are generated from the external database (in this case, a Microsoft Excel file). For more information, see
Database questions.
CreateMddFromQuanvert.mrs
This uses the DSC Registration component to access the Quanvert DSC, which is then used to create an MDM document (.
mdd) file for an existing Quanvert project. The MDM document can then be used to load the Quanvert project into UNICOM Intelligence Reporter or any other application that uses the UNICOM Intelligence Data Model to read the metadata. For large Quanvert multiprojects, this approach will deliver much better performance compared with using the Quanvert MDSC to read the metadata. For more information, see
Quanvert multiprojects.
CreateMddFromSav.mrs
This uses the DSC Registration component to access the , which is then used to create an MDM Document. This is subsequently saved as an .
mdd file using the MDM
Document.Save method. For more information, see
Example 6: Creating an .mdd file from a .sav file.
CreateMddFromSavProperties.mrs
This is similar to
CreateMddFromSav.mrs, but sets properties for the to use when it creates the MDM Document. You can use this script, for example, to set the ScanForCategories property to 0, so that the generated MDM Document will be the same as one generated by the prior to UNICOM Intelligence Data Model version 4.0. For more information about ScanForCategories, see "Determining Categories" in
Variable definitions when reading from a .sav file.
CreateMultipleDBQuestions.mrs
Defines a multiple response database question from responses that are generated from the external database (in this case, a Microsoft Excel file). For more information, see
Database questions.
CreatePaperRouting.mrs
This opens an .mdd file and creates a paper routing based on the Fields collection. Any previous paper routing is overwritten. Use this script to enable .mdd files created in UNICOM Intelligence Professional (which use web routing) to be opened in UNICOM Intelligence Interviewer - Paper.
CreateSingleDBQuestions.mrs
Defines a single response database question from responses that are generated from the external database (in this case, a Microsoft Excel file). For more information, see
Database questions.
CreateSQLDatabase.mrs
This creates a SQL Server database. To run this example, you need either SQL Server or the SQL Server Desktop Engine (MSDE) to be installed on your computer. For more information, see
Example 8: Creating a SQL Server database.
DebugQuotaReport.mrs
You can use this script to check quota counts when testing quotas in the UNICOM Intelligence Professional Interview Option.
DerivedVariables.mrs
This creates a derived categorical variable called
YoungPeople in the Museum sample data set. For more information, see
Example 4: Creating a derived variable.
EnumerateTypeLibraryInfo.mrs
Provides a simple method for using a standard Microsoft object to create a text file and an UNICOM Intelligence Data Model object in order to retrieve a type information list for the UNICOM Intelligence Reporter Tom Document Class and the UNICOM Intelligence IOM RunningInterviews Class. For more information, see
Example 10: Enumerating the table and interview object model type library information.
ExportCaseDataToQuantum.mrs
This provides an example of using ADO to transfer case data from the
The Short Drinks sample to a Quantum format .
dat file. This sample uses the newer OLE DB-based RDB DSC 2. To run this sample, you need UNICOM Intelligence Data Model 3.0 or later and access to a SQL Server installation and appropriate user access rights. You also need to set up card, column, and punch definitions in the Short Drinks .
mdd file
before running this sample. You can do this using the
Metadata Model to Quantum accessory or using the
MDM2Quantum.mrs sample.
ExportHtmlRender.mrs
Allows you to export your tables and charts to HTML. Instead of using a properties XML file, you can now use the IRender interface properties to customize your output. You can also use the IRender interface to export tables into a HTML string; the HTML string can then be inserted into an existing HTML page. For more information, see
HTML tables export: Working with the HTML Export Render Object.
ExportTomrScriptMetadata.mrs
This shows how to create an mrScriptMetadata file from an .
mdd file. For more information, see
Example 5: Creating Quancept script and mrScriptMetadata from an .mdd file.
ExportToQuancept.mrs
This shows how to create a Quancept script from an .
mdd file. For more information, see
Example 5: Creating Quancept script and mrScriptMetadata from an .mdd file.
FormatOrdinalFunction.mrs
This script contains an mrScriptBasic function called FormatOrdinal that you can use to convert a number or text into an ordinal such as 1st, 3rd, 28th, -2.1th, nth, and so on. To use this function, add the following line to your script:
#include "[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\General\mrScriptBasic\FormatOrdinalFunction.mrs"
Functions.mrs
This iterates through the Evaluate component's Functions collection object and writes the name and parameters of each function to a text file. For more information, see
Example 1: Using objects and iterating through collections.
InitializeUsers.mrs
Demonstrates how to add and assign user and roles via batch.
JapaneseLabels.mrs
This iterates through the MDM Variables collection and writes the Japanese question and category texts to a text file. This sample demonstrates creating a text file with Unicode encoding, which is necessary when writing Japanese characters to a text file. When you open the text file, you will need to change to a font (such as MS Mincho) that supports Japanese characters. Note that you need to have Japanese installed on your computer to be able to view the Japanese texts.
JoinDocuments.mrs
This sample demonstrates using the MDM Document.Join method (see IDocument.Join
in the MDM Object Model Reference) using the parameters that make it work in a similar way to the merge that occurs when you activate UNICOM Intelligence Interviewer projects for the second and subsequent time. This sample also calls the MDM
Document.OpenClone method to extract version 2 of the Short Drinks sample .
mdd file, which is then used as the input to the
Document.Join method. This sample demonstrates using the
BitOr function.
See also