Overview
This how-to will show you how to measure time differences between parts in your survey.
Time differences can be given in most of the common time formats seconds, minutes, etc’.
How To Do It?
Option 1 - Measure the Total Duration
- Add the below script to the advanced scripts
function GetSectionDuration(inQStart, inQEnd)
{
var retVal = 0;
for (var i=inQStart; i<=inQEnd; i++)
{
retVal += GetQuestionDuration(i);
}
return retVal;
} - Add a dummy question to hold the duration you capture
-
Add an expression question before the last question that runs in the interview and in the Answers tab add the below code with the relevant questions from your survey
//Below code will measure the duration between Q1 and Q10
SetAnswer(Dummy1, GetSectionDuration(Q_1.Index, Q_10.Index);
Return 1;
Option 2 - Measure the Net Duration
You can use one of the 4 functions or the property NetDuration that were added to the ExecutionMgr. The propery and the functions are aimed to create a custom net duration measurement of parts of the survey.
- int NetDuration (the property) - returns the total net duration of this interview (All durations are reported in seconds)
- void NetDurationMeasureStart(String inKey) - Starts a new duration measurement
- void NetDurationMeasureClear(String inKey) - removes the given duration.
- int NetDurationMeasureStop(String inKey) - Stops a duration measurement and returns the duration.
- int NetDurationMeasureValue(String inKey) - Returns the current value for the specified measurement.
This Measurements will work while the surveyor will use the 'Stop & Continue' and will automatically "resume" if stopped in the middle.
Clearing a measurement will write to the log the current value and then remove it.
It is up to you to decide what to do with the measurement for example: if its information that is needed to be visible in the Observation Control, you should put it in Vars/Expression/Question etc.
Please find an example on how to use it to measure a chapter's length:
Chapter's Start script:
ExecutionMgr.NetDurationMeasureStart("Chapter 1");
Chapter's End Script:
var length = ExecutionMgr.NetDurationMeasureStop("Chapter 1");
if (length < 30){
Prompt("This chapter should not take less than 30 seconds");
}
That’s it!
Comments
Please sign in to leave a comment.