How To Measure Time Of Specific Questionnaire Parts

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

In the place where you want to tick the start time add an expression question with the following code:

if (!Answered(CurrQues))
{
     SetAnswer(CurrQues, Now);
}

return Answer(CurrQues);

This will capture the current time & date as the answer of that expression question (to learn more about expression question click here).

Similarly, add another expression question where you want to tick the end time, with the exact same code as above.

*Note: These code lines should be written in the expression questions Answers tab section.

To save the time difference between the start time and time, you can use one of the following Time Difference functions:

TimeDiffYears(EndTimeValue,StartTimeValue);

TimeDiffMonths(EndTimeValue,StartTimeValue);

TimeDiffDays(EndTimeValue,StartTimeValue);

TimeDiffHours(EndTimeValue,StartTimeValue);

TimeDiffMinutes(EndTimeValue,StartTimeValue);

TimeDiffMilliSeconds(EndTimeValue,StartTimeValue);

TimeDiffSeconds(EndTimeValue,StartTimeValue);

*Note: The "EndTimeValue" variable would be the answer of the expression question of the end time. The "startTimeValue" variable would be the answer of the expression question of the start time.

Each function will return a numeric value which corresponds to the difference in the given time format.
You can return this value in an expression question, or even use it for rules and scripts!

Example

In this example, all I did is capture the time taken between "Q1" and "Q2":
start_time.PNG

end_time.PNG

And created an entrance rule for question 2, so it would enter it only if the difference was greater than 10.

time_entrance.PNG

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!

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.