Problems with now() function

Hello!

I'm currently building a form in which I need to let the enumerator know how much time he has spent for a field sampling. He has two hours to complete his sampling and this is a rule that must be followed.

The form presents a repeating group in which he must write down data about the observation of a specimen in the wild. With each iteration of this repeating group, I would very much like to be able to alert him how much time he has left. However, I have not been able to do this by using the now() - initial_time approach, because I have noticed that the now() function seems to be static, being evaluated only at the moment the form is opened.

I'm thinking of asking the enumerator to fill in the time every new iteration in the looping, but the ideal scenario is that he wouldn't even have to worry about it.

Could someone tell me if there is any other way to approach the problem?

Thanks!

You can trigger now() when a specific field is changed. See the first example at https://xlsform.org/en/#trigger. For example, you can add a field that is set to now() when the first question in your specimen observation repeat is set by the data collector.

2 Likes

Thanks. This solution works.