Professional > Data management scripting > Working with UNICOM Intelligence Interviewer - Server data > Exporting UNICOM Intelligence Interviewer - Server data to Quantum > Exporting batches of UNICOM Intelligence Interviewer - Server data to Quantum
 
Exporting batches of UNICOM Intelligence Interviewer - Server data to Quantum
In an ongoing project, you may want to export data in batches. For example, at the end of each day you may want to export all of the data collected since the end of the previous day, and you may want to export the batches of data to the same .dat file. The UNICOM Intelligence Developer Documentation Library comes with two sample DMS files that are designed to enable you to do this. The samples are called mrInterviewFirstBatchToQuantum.dms and mrInterviewNextBatchToQuantum.dms and are designed for use in a multiversion project. These files open all versions of the metadata, which means that they can handle most version changes. However, there are some version changes that will require special handling, but this is described below.
The sample mrInterviewFirstBatchToQuantum.dms transfers the current UNICOM Intelligence Interviewer - Server data to a new Quantum .dat file. The second sample (mrInterviewNextBatchToQuantum.dms) uses the read capability of the Quantum data source component (DSC) to find the existing case on the Quantum .dat file that has the latest interview finish date and time (by reference to the value of the system variable DataCollection.FinishTime). Only those cases that have a later interview finish time than this are then exported from UNICOM Intelligence Interviewer - Server to the .dat file.
Only the first file (mrInterviewFirstBatchToQuantum.dms) includes code to create a Quantum specification, on the assumption that you will probably want to start editing your Quantum specification right after running the first transfer. When there is a change in the data map in subsequent exports, you will need to change the specification manually. However, you can use the .csv file created by the subsequent transfers to get information on the changes to the data map that you need to manually incorporate into the specification. For more information, see Creating the Quantum specification.
Neither of these samples saves the output metadata. Saving the output metadata can take a long time in a large project and is generally not necessary when using these samples because the card, column, and punch definitions are set up in the input .mdd file. However, if you want to save the output metadata, add the MetaDataOutputName parameter to the OutputDataSource section.
mrInterviewFirstBatchToQuantum.dms
You use this sample when you export the first batch to Quantum. It does the following:
In the OnBeforeJobStart Event section it opens all versions of the input metadata, clears existing card, column, and punch definitions, sets up new ones, and writes the Quantum specification. The code used is similar to the card column-related code described in Exporting UNICOM Intelligence Interviewer - Server Data to Quantum using all versions.
Exports all non-test data that has the Completed status to a Quantum .dat file.
mrInterviewNextBatchToQuantum.dms
You use this sample to export the second and subsequent batches to Quantum. It does the following:
In the OnBeforeJobStart Event section, it opens all versions of the input metadata and allocates card, column, and punch definitions to any variables and categories that do not have them already, and writes the card, column, and punch definitions to a .csv file.
Exports to a Quantum .dat file all non-test data that has the Completed status and an interview finish time that is later than the latest case already on the .dat file.
This sample fails if you run it before running the mrInterviewFirstBatchToQuantum.dms file. It will not transfer any records if you run it immediately after running mrInterviewFirstBatchToQuantum.dms without collecting any additional data in between.
Exporting batches when there have been version changes
Both of the samples described in this topic use all versions of the metadata. This means that the samples can handle most changes to the data layout. The main potential problem area is likely to be if you add large numbers of categories to an existing variable. If you add more categories to a variable than can be accommodated in the spare columns that are available, the variable will be moved to the last card so that additional columns can be allocated. If this happens it would mean that in earlier records in the .dat file the variable would be stored using different columns and you would need to handle this appropriately in Quantum. This might happen when you add categories to a multiple response variable and are using the explode multipunch option because each category is assigned a separate column.
Note The mrInterviewFirstBatchToQuantum.dms and mrInterviewNextBatchToQuantum.dms sample DMS files are 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