Could anyone help me with this issue:
I am in need of counting the time consuming for each section consisting of 10 questions for instance. I used now() function before and after the section but unfortunately, it was not working because “now()” function gives constant values for both. I used once() function with now() but also did not work: format-date-time(once(now()), ‘%H:%M:%S’).
What I should do?
You could try this out using the audit meta question type. Please see the support article on Audit Logging Meta Question Type for detailed step by step guide.
Dear Kal_Lam,
Thanks for your concern and answering my question. But may be you did not get my point, I meant time spent per section to be appear after section finishing directly at the time of conducting interviews on KoboCollect. So, how can we do that?
Delshad
Basically, it takes a timestamp the moment you finish answering the question that is immediately before your group/section [there’s no way short of pulling raw data out of the audit log to get the actual timestamp you started the group, so this is the next best thing…]. Then it takes another timestamp to moment you finish answering all the questions in the group; since you might answer them in any order, I check all of them not merely the last in the group.
The ‘secret sauce’ here is probably capturing the timestamp with a conditionalonce(now()) - if the condition isnt met the calculation returns null, so the calculation will keep firing till its met. Once met, the timestamp wont be overwritten.
Note: unfortunately, Enketo currently truncates decimal-date-time() values to 3 decimal places (!) which severely limits the precision of these timestamps to approx 86sec (1/1000 of a day). This will hopefully soon be fixed in https://github.com/enketo/enketo-xpathjs/issues/70. So if you test this under Kobo preview, go get a coffee before answering the last question in the group…