Desktop User Guides > Professional > Table scripting > Getting started > Loading other types of data
 
Loading other types of data
Sample script files: RDBTables.mrs, SavTables.mrs, QuanvertTables.mrs, QuanceptTables.mrs, QuantumTables.mrs, SurveycraftTables.mrs
If you have worked through the examples in this section methodically, you will have noticed that up to now all of the examples use the Museum sample XML data set. This consists of metadata in the form of an .mdd file and case data in an XML file. However, you are not limited to using this type of data. The Table Object Model can read any type of data that is supported by the UNICOM Intelligence Data Model provided a suitable metadata source is available. The metadata can be in the form of an .mdd file or any other format for which a suitable read-enabled MDSC is available. This topic provides examples of using data in various formats. The sample files demonstrate loading each of the main data formats that are supported by the UNICOM Intelligence Data Model by default.
Loading UNICOM Intelligence data stored in a relational MR (RDB) database
When UNICOM Intelligence case data is stored in an RDB database, the metadata is typically stored in an .mdd file. If the .mdd file is set up with the RDB database as the default data source, generally you do not need to specify the case data location and so you can load the .mdd file without specifying the case data location as shown in Creating a simple table of Age by Gender. This is typically true if you are using the main UNICOM Intelligence Interviewer - Server Admin.mdd file (in the FMRoot\Shared folder).
However, sometimes you need to specify the location of the database. For example:
' Load the short drinks sample .mdd file
TableDoc.DataSet.Load("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Mdd\short_drinks.mdd", _
, _
  "Provider=MSOLEDBSQL.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=short_drinks;Data Source=LocalHost", _
  "mrRdbDsc2", _
  "short_drinks")
The Document.DataSet.Load method has five parameters. For clarity in this example each parameter has been placed on a separate line:
1 The name and location of the metadata, which in this example is the .mdd file.
2 The MDSC. This parameter is blank in this example because the metadata is in the form of an .mdd file, which means that an MDSC is not required.
3 The name and location of the case data. When the case data is in an RDB database, you can specify the location using an OLE DB connection string. For more information, see Connecting to a relational MR database using RDB DSC 2.
4 The CDSC to be used. For an RDB database, this is mrRdbDsc2.
5 The project name. This is typically used only with RDB data and is usually the same as the database name.
Loading an SPSS .sav file
You can load a .sav file using the SPSS Statistics SAV DSC to read the metadata like this:
' Load the Employee Data sample .sav file
TableDoc.DataSet.Load("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Sav\Employee data.sav", "mrSavDsc")
However, if the .sav file was created by exporting UNICOM Intelligence data, it is usually preferable to use the .mdd file that was used to create it. (This is the output metadata file if the .sav file was created using a data management script.) You then specify the parameters like this:
TableDoc.DataSet.Load("[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Sav\Employee data.mdd", _
, _
"[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\ Data\Sav\Employee data.sav", "mrSavDsc")
Before running this example, you must create an .mdd file from the Employee data.sav file , because the UNICOM Intelligence Developer Documentation Library does not include an .mdd file for the Employee data.sav file. For more information, see Creating an MDM document from an SPSS Statistics.sav file.
Next
Opening an existing table document
See also
Getting started