Professional > Data management scripting > Working with UNICOM Intelligence Interviewer - Server data > Exporting UNICOM Intelligence Interviewer - Server data to Quantum > Exporting UNICOM Intelligence Interviewer - Server Data to Quantum using all versions
 
Exporting UNICOM Intelligence Interviewer - Server Data to Quantum using all versions
It is easy to export data for all versions at the end of your project. You simply select all of the versions of the metadata and export all of the data in one run. The mrInterviewAllVersionsToQuantum.dms sample has been designed to cater for this scenario and does the following:
1 Opens all versions of the .mdd file.
2 Calls the MDM2Quantum.ClearCardColPunch method to clear any existing card, column, and punch definitions. You should remove this line if you want to retain any card, column, and punch definitions that you have already set up, for example, using the Metadata Model to Quantum accessory.
3 Sets the Metadata Model to Quantum properties to use the standard Quantum setting of multiple cards with 80 columns. You should remove these lines if you want to use a single card of unlimited length or have already set up your card, column, and punch definitions, for example, using the Metadata Model to Quantum accessory.
4 Sets the MDM2Quantum.SpareColumns property to 2. This means that two extra columns will be allocated to each categorical variable to allow for the addition of extra categories. This is not necessary if you are using this DMS file to export the data after all data collection has finished. However, it is useful if you are running the export part way through the collection process and want to allow space for categories being added in later versions.
5 There are some other properties of the MDM2Quantum object that correspond to preferences you can set in the Metadata Model to Quantum accessory (such as, ExplodeMultiPunch, CodesOnSeparateCard, OtherCodesOnSeparateCard, and AllocateSystemVariables). If you want to use any of these properties, you should set them before the call to the AllocateCardColPunch method.
6 Calls the MDM2Quantum.AllocateCardColPunch method with the MoveToEnd parameter set to True. This allocates card, column, and punch definitions to all of the variables in the document.
7 Uses the FileSystemObject to create a new folder for the output, if it does not already exist. This is a useful technique to help make sure that the Quantum specification files do not overwrite those from a different data set. Although most of the specification filenames are based on the name supplied in the script, the names of the include files created for numeric grids are based on the axis names. This means that these files may be overwritten if there are any numeric grids with the same name in the two data sets.
8 Writes out a basic Quantum specification based on the card, column, and punch definitions.
9 Exports all non-test data that has the Completed status to a Quantum .dat file.
Notes
This sample does not save the output metadata. Saving the output metadata can take a long time in a large project and it is not generally necessary when using this sample because the card, column, and punch definitions are set up in the input .mdd file in the OnBeforeJobStart Event section. However, if you want to save the output metadata, add the MetaDataOutputName parameter to the OutputDataSource Section.
This sample is designed to be run once, typically at the end of a project. If you want to use this sample to export data part way through a project and you want to export data to the same .dat file later in the project, this sample would be suitable for the first export, but not for subsequent ones. However, you could amend the OnBeforeJobStart Event section to remove the line that clears the existing card, column, and punch definitions and set the Metadata Model to Quantum properties (points 2 through 5 in the list above) before running it again.
The mrInterviewAllVersionsToQuantum.dms sample DMS file is installed with the UNICOM Intelligence Developer Documentation Library. For more information, see Sample DMS files for exporting UNICOM Intelligence Interviewer data.
See also
Exporting UNICOM Intelligence Interviewer - Server data to Quantum