Desktop User Guides > Professional > Data management scripting > Transferring data using a DMS file > Reading data > Transferring data from Quanvert
 
Transferring data from Quanvert
You can transfer data from a Quanvert database using Quanvert DSC.
Packed databases
In UNICOM Intelligence Professional, you can transfer data from both packed and unpacked databases. You can tell the difference between a packed and unpacked Quanvert database because a packed one consists of one or more files with a .pkd filename extension whereas an unpacked database consists of many files including a header file called qvinfo. For more information about working with packed databases, see Packed Quanvert projects.
Quanvert levels projects
These are hierarchical data sets and only the top level can be represented in the flat VDATA virtual table. This means that if you attempt to use a DMS file to transfer a Quanvert levels project to another format or location, only the top level will be transferred and no error message will be issued. If necessary, you can include code in the OnBeforeJobStart Event section to check whether it is a levels project. By raising an error and not trapping it, you can stop the job. For example:
Event(OnBeforeJobStart, "Create the .mdd file")
Dim MDM, DSC, DSCs, MDMField

' Create the Data source component Collection
Set DSCs = CreateObject("MRDSCReg.Components")

' Find the Quanvert DSC
Set DSC = DSCs["mrQvDsc"]

' Create an MDM Document from the Quanvert database
Set MDM = DSC.Metadata.Open("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\Quanvert\Household\qvinfo")

For Each MDMField In MDM.Fields
If MDMField.ObjectTypeValue = ObjectTypesConstants.mtArray Then
If MDMField.Type = ArrayTypeConstants.mlLevel Then
On Error Goto 0
Err.Raise(1, , "This is a Quanvert Levels Project - Job stopped")
End If
End If
Next

'Save the MDM Document
MDM.Save("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Household.mdd")
MDM.Close()
End Event
For more information, see Quanvert levels projects.
Quanvert multiprojects
The Quanvert multiproject feature enables you to analyze together the data in separate but related Quanvert projects. Quanvert multiprojects are made up of two or more projects (generally called subprojects but sometimes referred to as waves). When you create a multiproject in Quanvert, you specify the projects you want to include in the multiproject, the master subproject, and the folder in which the multiproject is to be created. Quanvert then creates the multiproject in the specified folder without changing the subprojects in any way. You can export a Quanvert multiproject using a DMS file: you specify the qvinfo file in the folder in which the multiproject was created in the normal way. However, for large multiprojects, you can improve the performance of the export by creating an MDM document (.mdd) file first and using that file for the transfer. For more information, see Quanvert multiprojects.
Special Quanvert information
Quanvert categorical variables (which are called axes) usually contain special elements, which define summary and statistics rows and intermediate values for use during tabulation. The Quanvert DSC creates two columns in the virtual table for categorical variables that contain these special elements. The first (called varname, where varname is the axis name) stores the responses to the categories and the second (called varname.ex) stores the data for the special elements. Quanvert DSC creates the varname.ex variables as helper fields in the metadata and sets up some custom properties to store Quanvert-specific information.
Some applications, such as UNICOM Intelligence Reporter - Survey Tabulation, can make use of the special elements and recombine the variables when reading a Quanvert database. However, the Quanvert-specific information is generally not relevant in other data formats, such as IBM SPSS Statistics. The QuanvertToSav.dms sample provides an example of deleting the varname.ex variables.
Large Quanvert projects
Quanvert DSC cannot read data for more than 2039 variables at once. (For this calculation, you need to count the number of Quanvert variables, not the number of variables that are created in the UNICOM Intelligence Data Model. Each variable that is displayed in the Available Variables frame in Quanvert generally counts as one variable. However, some categorical and grid variables have numeric data associated with them and each of these variables counts as two variables.) This limit is most likely to be reached if you attempt to export all of the variables in a large Quanvert project, for example using a SELECT * FROM vdata select query in the InputDataSource section. However, the export should succeed if you change the SELECT statement to include fewer than 2040 Quanvert variables (510 in Data Model 2.6).
Using a select query
There is a known problem that affects exports that use Quanvert MDSC to read the metadata. This problem means that if you specify in the select query a subset of the variables in the database, all of the variables will be included in the output data source. However, case data is transferred for the specified variables only. However, this does not happen if you use an .mdd file as the input metadata for the export. You can create an .mdd file in the OnBeforeJobStart Event section and specify the new .mdd file as the metadata source in the InputDataSource section. There is an example of doing this later in this topic.
Reading from a Quanvert database
Method 1. Using Quanvert DSC to read the metadata
In the connection string in the InputDataSource section, specify mrQvDsc for both the Data Source and the MR Init MDSC connection properties. Specify the name and location of the qvinfo or .pkd file for both the Location and Initial Catalog connection properties:
InputDatasource(myInputDataSource, "My input data source")
  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=mrQvDsc; _
    Location=<Name and location of qvinfo or .pkd file>; _
    Initial Catalog=<Name and location of qvinfo or .pkd file>; _
    MR Init MDSC=mrQvDsc"
End InputDatasource
Method 2. Using an .mdd file
In the connection string in the InputDataSource section, specify mrQvDsc for the Data Source connection property and leave the MR Init MDSC connection property blank. Specify the name and location of the qvinfo or .pkd file for the Location connection property and specify the name and location of the .mdd file for the Initial Catalog connection property:
InputDatasource(myInputDataSource, "My input data source")
  ConnectionString = "Provider=mrOleDB.Provider.2; _
    Data Source=mrQvDsc; _
    Location=<Name and location of qvinfo or .pkd file>; _
    Initial Catalog=<Name and location of mdd file>"
End InputDatasource
Example
The following example does the following:
Uses the DSC Registration component to access the Quanvert DSC, which is then used to create an MDM Document object from a Quanvert database.
Saves the MDM Document object as an .mdd file, which is then specified as the input metadata source in the InputDataSource section.
Uses SPSS Statistics SAV DSC to transfer the case data to a .sav file.
Event(OnBeforeJobStart, "Create the .mdd file")
Dim MDM, DSC, DSCs

' Create the Data source component Collection
Set DSCs = CreateObject("MRDSCReg.Components")

' Find the Quanvert DSC
Set DSC = DSCs["mrQvDsc"]

' Create an MDM Document from the Quanvert database
Set MDM = DSC.Metadata.Open("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\Quanvert\Museum\qvinfo")

' Save the MDM document out to an .mdd file which we will use in the file transfer.
MDM.Save("C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Museum.mdd")

MDM.Close()

End Event

InputDatasource(myInputDataSource, "My input data source")
ConnectionString = "Provider=mrOleDB.Provider.2; _
Data Source=mrQvDsc; _
Location=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\Quanvert\Museum\qvinfo; _
Initial Catalog=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\Museum.mdd"
End InputDatasource

OutputDataSource(myOutputDataSource, "My output data source")
ConnectionString = "Provider=mrOleDB.Provider.2; _
Data Source=mrSavDsc; _
Location=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\QuanvertToSav.sav"
MetaDataOutputName = "C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Output\QuanvertToSav.mdd"
End OutputDataSource
A similar example is provided as a sample DMS file called QuanvertToSav.dms, which is installed with the UNICOM Intelligence Developer Documentation Library. For an example that transfers data from a packed database, see the QuanvertPkdToDDF.dms sample. For more information, see Sample DMS files.
See
Reading data