Calculating Time Taken to Fill a Form

​Hello,
Does anyone know how I can calculate the ELAPSED TIME between the first
question on a form and the last one or any other question on the same form?

For example, if the interview started at 8:00 and it ended at say 8:15.

I do not want the interviewer to enter hence I cannot use the Time
question. I want to capture it automatically using Hidden value

Yaw

Hi Yaw,

This value is recorded automatically in the form metadata
https://confluence.dimagi.com/display/commcarepublic/Metadata+Glossary,
specifically timeStart and timeEnd. This data should be automatically
included in your form exports.

Cheers,
Will

··· On Mon, Jul 10, 2017 at 6:00 AM, YAW ANTWI-ADJEI wrote:

​Hello,
Does anyone know how I can calculate the ELAPSED TIME between the first
question on a form and the last one or any other question on the same form?

For example, if the interview started at 8:00 and it ended at say 8:15.

I do not want the interviewer to enter hence I cannot use the Time
question. I want to capture it automatically using Hidden value

Yaw

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will,
Let me check on this whether it will solve my problem.

Thank you

Yaw ​

··· On 10 July 2017 at 10:55, William Pride wrote:

Hi Yaw,

This value is recorded automatically in the form metadata
https://confluence.dimagi.com/display/commcarepublic/Metadata+Glossary,
specifically timeStart and timeEnd. This data should be automatically
included in your form exports.

Cheers,
Will

On Mon, Jul 10, 2017 at 6:00 AM, YAW ANTWI-ADJEI yawantwiadjei@gmail.com wrote:

​Hello,
Does anyone know how I can calculate the ELAPSED TIME between the first
question on a form and the last one or any other question on the same form?

For example, if the interview started at 8:00 and it ended at say 8:15.

I do not want the interviewer to enter hence I cannot use the Time
question. I want to capture it automatically using Hidden value

Yaw

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Commcare provides started time and completed time so you don't need to
calculate .

··· On Monday, July 10, 2017 at 3:30:52 PM UTC+5:30, YAW ANTWI-ADJEI wrote: > > ​Hello, > Does anyone know how I can calculate the ELAPSED TIME between the first > question on a form and the last one or any other question on the same form? > > For example, if the interview started at 8:00 and it ended at say 8:15. > > I do not want the interviewer to enter hence I cannot use the Time > question. I want to capture it automatically using Hidden value > > Yaw >

Hi Will,
The problem I have with the metadata fields is that I cannot display it on
the screen immediately the discussion ends for the officer to know the
exact time spent with the visitor.

The app is for visitor management where for every visitor once you go
through the reception, every officer you visit should be able to know the
exact time spent.

If there is a way that I can display it as the very last question on the
form that will solve my problem.

Yaw

··· On 10 Jul 2017 10:55, "William Pride" wrote:

Hi Yaw,

This value is recorded automatically in the form metadata
https://confluence.dimagi.com/display/commcarepublic/Metadata+Glossary,
specifically timeStart and timeEnd. This data should be automatically
included in your form exports.

Cheers,
Will

On Mon, Jul 10, 2017 at 6:00 AM, YAW ANTWI-ADJEI yawantwiadjei@gmail.com wrote:

​Hello,
Does anyone know how I can calculate the ELAPSED TIME between the first
question on a form and the last one or any other question on the same form?

For example, if the interview started at 8:00 and it ended at say 8:15.

I do not want the interviewer to enter hence I cannot use the Time
question. I want to capture it automatically using Hidden value

Yaw

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Yaw,

You should be able to do the calculation by taking the difference between
/data/meta/timeStart (as described above) and now()

Cheers,
Will

··· On Wed, Jul 19, 2017 at 5:13 AM, YAW ANTWI-ADJEI wrote:

Hi Will,
The problem I have with the metadata fields is that I cannot display it on
the screen immediately the discussion ends for the officer to know the
exact time spent with the visitor.

The app is for visitor management where for every visitor once you go
through the reception, every officer you visit should be able to know the
exact time spent.

If there is a way that I can display it as the very last question on the
form that will solve my problem.

Yaw

On 10 Jul 2017 10:55, "William Pride" wpride@dimagi.com wrote:

Hi Yaw,

This value is recorded automatically in the form metadata
https://confluence.dimagi.com/display/commcarepublic/Metadata+Glossary,
specifically timeStart and timeEnd. This data should be automatically
included in your form exports.

Cheers,
Will

On Mon, Jul 10, 2017 at 6:00 AM, YAW ANTWI-ADJEI <yawantwiadjei@gmail.com wrote:

​Hello,
Does anyone know how I can calculate the ELAPSED TIME between the first
question on a form and the last one or any other question on the same form?

For example, if the interview started at 8:00 and it ended at say 8:15.

I do not want the interviewer to enter hence I cannot use the Time
question. I want to capture it automatically using Hidden value

Yaw

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will,
Thank you.

Yaw

··· On 19 Jul 2017 11:57, "William Pride" wrote:

Hi Yaw,

You should be able to do the calculation by taking the difference between
/data/meta/timeStart (as described above) and now()

Cheers,
Will

On Wed, Jul 19, 2017 at 5:13 AM, YAW ANTWI-ADJEI yawantwiadjei@gmail.com wrote:

Hi Will,
The problem I have with the metadata fields is that I cannot display it
on the screen immediately the discussion ends for the officer to know the
exact time spent with the visitor.

The app is for visitor management where for every visitor once you go
through the reception, every officer you visit should be able to know the
exact time spent.

If there is a way that I can display it as the very last question on the
form that will solve my problem.

Yaw

On 10 Jul 2017 10:55, "William Pride" wpride@dimagi.com wrote:

Hi Yaw,

This value is recorded automatically in the form metadata
https://confluence.dimagi.com/display/commcarepublic/Metadata+Glossary,
specifically timeStart and timeEnd. This data should be automatically
included in your form exports.

Cheers,
Will

On Mon, Jul 10, 2017 at 6:00 AM, YAW ANTWI-ADJEI < yawantwiadjei@gmail.com> wrote:

​Hello,
Does anyone know how I can calculate the ELAPSED TIME between the first
question on a form and the last one or any other question on the same form?

For example, if the interview started at 8:00 and it ended at say 8:15.

I do not want the interviewer to enter hence I cannot use the Time
question. I want to capture it automatically using Hidden value

Yaw

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi @William_Pride! I have a question regarding the /data/meta/timeStart path. What is the output of that, exactly?

This path contains an ISO-8061 formatted timestamp that contains the date/time when the form session was first opened.

I think this advice is a little out of date, though. It's easy to use the timeStart / timeEnd data in exports to get elapsed form time, but it's less easy to do it within form logic.

I'd recommend setting your own "start_time" hidden value so you have more control / visibility into it

I'd create a hidden value with the default value set to:

double(now())

which will contain a days+fractional days timestamp that's easier to manipulate.

To get the minutes since a form was started, for instance, you could then calculate

double(now()) - #form/start_time) * (24) * (60)

-Clayton