Professional > Data management scripting > Working with UNICOM Intelligence Interviewer - Server data > Selecting multiple versions
 
Selecting multiple versions
You can select multiple versions of the metadata to be used and as we saw in Selecting a specific version, it is easy to set up a filter to restrict the transfer to records that were collected using the corresponding versions.
Specifying multiple metadata versions. You specify multiple versions of the metadata to be used in the transfer by using a version expression for the MR Init MDM Version connection property in the connection string in the InputDataSource section.
Specifying multiple metadata versions
You specify multiple versions of the metadata to be used in the transfer by using a version expression for the MR Init MDM Version connection property in the connection string in the InputDataSource section. The version expression also determines the order of priority to be used when, for example, texts in one version conflict with those in another version.
If you are using the Data Link Properties dialog box to set up the connection string (for example, because you are using the Connection String Builder or WinDMSRun) click Properties in the Metadata section on the Connection tab. This opens the Metadata Properties dialog box, in which you can select the version or versions you want to use from the Version list box. See WinDMSRun window: Selecting versions.
When you select multiple versions for the transfer, the output metadata will be based on the combined versions only and will not contain the individual versions.
If you want to restrict the transfer to case data records that were collected using one or more specific versions of the metadata, filter using the DataCollection.MetadataVersionNumber system variable. You can include the case data for a major version and all of its minor versions by using the LIKE keyword and the % wildcard character.
Example 1. Selecting all versions
This example selects all versions of the metadata and does not filter the case data.
InputDatasource(mrInterviewData)
ConnectionString = "Provider=mrOleDB.Provider.2; _
Data Source=mrRdbDsc2; _
Initial Catalog=C:\Program Files\IBM\SPSS\DataCollection\
      7\DDL\Data\Mdd\short_drinks.mdd; _
Location="Provider=SQLOLEDB.1; _
Integrated Security=SSPI; _
Persist Security Info=False; _
Initial Catalog=short_drinks; _
Data Source=LocalHost"; _
MR Init MDM Version={..}; _
MR Init Project=short_drinks"
SelectQuery = "SELECT * FROM vdata _
WHERE (ContainsAny(DataCollection.Status, {completed})) _
AND NOT (DataCollection.Status >= {test})"
End InputDatasource
This example is in the mrInterviewAllVersionsToSav.dms sample: see Sample DMS files for exporting UNICOM Intelligence Interviewer data.
Example 2. Selecting two specific versions
This example selects two specific versions of the metadata and case data collected with the same versions and any related minor versions. (The Short Drinks sample does not actually contain any minor versions.)
InputDatasource(mrInterviewData)
ConnectionString = "Provider=mrOleDB.Provider.2; _
Data Source=mrRdbDsc2; _
Initial Catalog=C:\Program Files\IBM\SPSS\
          DataCollection\7\DDL\Data\Mdd\short_drinks.mdd; _
Location="Provider=SQLOLEDB.1; _
Integrated Security=SSPI; _
Persist Security Info=False; _
Initial Catalog=short_drinks; _
Data Source=LocalHost"; _
MR Init MDM Version={2,5}; _
MR Init Project=short_drinks"
SelectQuery = "SELECT Respondent.Serial, age, gender,
         sclass, occup FROM vdata _
WHERE (DataCollection.MetadataVersionNumber ='2' _
OR DataCollection.MetadataVersionNumber LIKE '2:%' _
OR DataCollection.MetadataVersionNumber ='5' _
OR DataCollection.MetadataVersionNumber LIKE '5:%') _
AND ContainsAny(DataCollection.Status, {completed}) _
AND NOT (DataCollection.Status >= {test})"
End InputDatasource
This example is in the mrInterviewMultipleVersionsToSav.dms sample. See Sample DMS files for exporting UNICOM Intelligence Interviewer data.
See also
Working with UNICOM Intelligence Interviewer - Server data