Professional > Using UNICOM Intelligence Professional > Using UNICOM Intelligence Professional to develop interviews > Accessing sample management data
 
Accessing sample management data
If your interview will use Sample management when activated in UNICOM Intelligence Interviewer - Server, and the routing section of your interview script (.mdd) file (see Using sample data in interviews) accesses sample data, you can test your interview script before activating it.
Sample Management data is stored in a Sample User XML (.xsu) file, which contains a single sample record with one or more fields. The records and fields are defined using XML syntax. Each field has a name, a type and a value. Note that you cannot have more than one sample record in a .xsu file, and each project's .xsu file must be in the <ProjectMDD>_files sub-directory.
The following sample record is from a file called Participant.xsu, which by default can be found in this folder:
%APPDATA%\IBM\SPSS\DataCollection\<version>\Professional\ Interview
The sample record contains three fields called ID, UserName and Password.
<SampleRecord ID="ID1">
  <SampleFields>
    <SampleField>
      <name>ID</name>
      <type>8</type>
      <value>ID1</value>
    </SampleField>
    <SampleField>
      <name>UserName</name>
      <type>8</type>
      <value>Name1</value>
    </SampleField>
    <SampleField>
      <name>Password</name>
      <type>8</type>
      <value>Password1</value>
    </SampleField>
  </SampleFields>
</SampleRecord>
When you create your own sample fields, you must give each field a type. A list of the valid values for the <type> element is shown in the following table. Make sure that the types in your Sample User XML file match the equivalent SQL field types for the sample table (sometimes known as the participants table) that your interview will use after activation.
Value of <type>
Equivalent SQL Field Type
2
Smallint
3
Int
7
Datetime
8
Char, Text, Ntext, or Nvarchar
11
Bit
For an example of the code you need to write to access the data in the sample record, see [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\Interview\Sample Management - Scripts\Basic\Basic.mdd, which is intended to be used with Participant.xsu. The relevant parts of the script are shown below. When the script is run, the browser should display the message “Welcome to the Drinks Survey Name1”, as Name1 is the value of the UserName field in Participant.xsu.
Metadata(en-US, Question, label)
  ...
  Welcome "Welcome to the Drinks survey {UserName}." info;
  ...
End Metadata
Routing(Web)
' Get the UserName from the sample record
Welcome.Label.Inserts["UserName"].Text = IOM.SampleRecord.Item["UserName"]
Welcome.Show()
  ...
End Routing
See also
Using sample management
Sample scripts
Using UNICOM Intelligence Professional to develop interviews