Desktop User Guides > Professional > Data management scripting > Transferring data using a DMS file > Reading data > Reading metadata
 
Reading metadata
When you transfer data using a DMS file and the UNICOM Intelligence Data Model, you generally need to specify an input metadata source. The metadata source can be a Metadata Document (.mdd) file or a proprietary data format for which an MDSC is available. However, for some data types you do not need to specify a metadata source, although it is usually preferable to do so, because without an input metadata source, you cannot use these sections:
OnAfterMetaDataTransformation Event section
OnJobStart Event section
OnNextCase Event section
OnJobEnd Event section
Moreover, if you are transferring data to a target data source that already exists without using an input metadata source, the transfer will succeed only if the structure of the output data exactly matches the existing target data.
You define the input metadata source in the connection string in the InputDataSource section (see InputDataSource section). If you are using the Connection String Builder or WinDMSRun sample application to set up the connection string, you can select the metadata source and the MDSC (when relevant) on the Data Link Properties: Connection tab (provided the UNICOM Intelligence OLE DB Provider is selected on the Provider tab). Alternatively, you can type the connection string into the DMS file manually.
See also
Using an .mdd file
Using a proprietary metadata source
Transferring without using a metadata source
Reading data
Using an .mdd file
You specify a Metadata Document (.mdd) file in the connection string in the InputDataSource section as follows:
If you are setting up the connection string using the Data Link Properties dialog, choose the Connection tab and from the Metadata Type list, select UNICOM Intelligence Metadata Document. Then enter the Metadata Location: either type the name and location of the .mdd file, or click Browse. Make sure you select Open metadata read/write.
If you are setting up the connection string manually, set the Initial Catalog connection property to the name and location of the .mdd file:
InputDatasource(myInputDataSource, "My input data source")
  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=<Name of CDSC>; _
    Initial Catalog=<Name and location of .mdd file>; _
    Location=<Name and location of case data>"
End InputDatasource
If the .mdd file has more than one version, the most recent version will be used by default. However, you can select an earlier version by using the MR Init MDM Version connection property. For more information, see Selecting a specific version. You can also select multiple versions to use for the export: see Selecting multiple versions.
The .mdd file itself must be writable. If it is read‑only, an error occurs.
Name and location of case data
When you are using an .mdd file, you do not need to specify the name and location of the case data to be transferred if the following statements are both true:
The .mdd file already contains a DataSource object that is the same type as that specified in the connection string.
That DataSource object refers to the case data that you want to transfer.
In addition, if the DataSource object is the default data source in the .mdd file, you do not need to specify the name of the CDSC in the InputDataSource section.
For example, if you are transferring UNICOM Intelligence Interviewer - Server data using the .mdd file in the FMRoot\Shared folder on the File Management server, you generally do not need to specify the name and location of the case data, or the name of the CDSC, because those details will already be stored in the default DataSource object in the .mdd file.
Be careful when the DataSource object refers to case data that is stored in a file (such as a .sav file), and the path stored in the DataSource object is a relative path. In that situation, the path will be treated as if it relative to the location of the .mdd file. In contrast, in the InputDataSource section, if you specify the name and location of the case data using a relative path, the path will be treated as if it relative to the location of the DMS file being run.
See also
Reading metadata
Using a proprietary metadata source
You specify a proprietary metadata source in the connection string in the InputDataSource section as follows:
If you are setting up the connection string using the Data Link Properties dialog, select the Connection tab and from the Metadata Type list, select the type of metadata. (All of the metadata types for which a read-enabled MDSC is available will be listed.) Then enter the Metadata Location: type the name and location of the file or database, or click Browse.
If you are setting up the connection string manually, set the Initial Catalog connection property to the name and location of the file or database and the MR Init MDSC connection property to the name of the MDSC you are using to read the metadata:
InputDatasource(myInputDataSource, "My input data source")
  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=<Name of CDSC>; _
    Location=<Name and location of case data>; _
    Initial Catalog=<Name and location of metadata file or _
       database>
; _
    MR Init MDSC=<Name of MDSC>"
End InputDatasource
When you read from a proprietary data source, it is sometimes useful to create a Metadata Document (.mdd) file. For more information, see Creating an .mdd file from proprietary metadata.
See also
Reading metadata
Transferring without using a metadata source
For some types of data you do not need to specify a metadata source, although generally you will want to do so. It is possible to transfer data without specifying a metadata source only when using Relational MR Database CDSC, UNICOM Intelligence Data File CDSC, SPSS Statistics SAV DSC, or XML CDSC to write the case data (although transferring to a .sav file without a metadata source has some limitations. For more information, see Transferring data to IBM SPSS Statistics.
In the InputDataSource section, you can specify file locations using a relative path (that is, relative to the folder in which the DMS file is located when you run it).
See
Reading data