Desktop User Guides > Professional > Data management scripting > Working with UNICOM Intelligence Interviewer - Server data > Filtering on the interview finish time
 
Filtering on the interview finish time
When data is collected using UNICOM Intelligence Interviewer - Server, the DataCollection.StartTime and DataCollection.FinishTime system variables store the date and time that the interview started and finished. You can use these variables to filter the case data records according to the time the interview started or finished. For example, the following WHERE clause selects interviews that finished in the last 24 hours. (It uses the DateAdd function to subtract 24 hours from the date and time returned by the function.)
SelectQuery = "SELECT * FROM vdata _
WHERE (DataCollection.FinishTime > DateAdd(Now('UTC'), 'h', -24))"
The DataCollection.StartTime and DataCollection.FinishTime system variables store the times in coordinated universal time (UTC). (UTC was formerly referred to as Greenwich Mean Time or GMT.) To return the current date and time in UTC, use the UTC parameter for the Now function.
This example shows how to use the OnNextCase Event section for a similar result. Case data records whose finish time does not meet the criteria are filtered out of the export by using the Job.DropCurrentCase method.
Event(OnJobStart)
dmgrGlobal.Add("Last24hrs", DateAdd(Now("UTC"), "h", -24))
End Event

Event(OnNextCase)
If DataCollection.FinishTime < dmgrGlobal.Last24hrs Then
dmgrJob.DropCurrentCase()
End If
End Event
Generally, using a WHERE clause to select case data records is faster than using mrScriptBasic code in the OnNextCase Event section.
The code in this example is in the mrInterviewSelectOnFinishTime.dms sample DMS file in the UNICOM Intelligence Developer Documentation Library. For more information, see Sample DMS files for exporting UNICOM Intelligence Interviewer data.
See
Working with UNICOM Intelligence Interviewer - Server data