Desktop User Guides > Professional > Interview scripting > Sample management > Sample management functions > AddSampleRec
Use this function to add a new sample record to the sample table. This function is not called by UNICOM Intelligence Interviewer - Server directly.
Function AddSampleRec(SampleFields, SampleRec)
Input parameter of type SampleFields.
Output parameter of type SampleRec. In case of failure, SampleRec must be set to Nothing within this function.
The function in this example creates a new sample record from the sample fields passed to it, initializes the record by placing it in the first queue (FRESH), and adds the record to the sample table.
The function calls the Queues.AddSampleRec method to create the new sample record, add it to the FRESH queue, and return the sample record. If the sample record is added successfully, the function sets the return value to SUCCESS. If it is not added successfully, the function sets the return value to FAILURE.
Function AddSampleRec(SampleFields, SampleRec)
  Set SampleRec = Queues.AddSampleRec("FRESH", SampleFields)
  If (SampleRec Is Nothing) Then
    AddSampleRec = FAILURE
    AddSampleRec = SUCCESS
  End If
End Function
For more information about Queues.AddSampleRec, see Sample Management Object model.
See also
Sample management functions