Calculate_here (from SurveyCTO) or similar item available in ODK?

calculate_here is a datatype in SurveyCTO. I am porting a CTO survey to ODK and would really like to be able to use the same functionality.

1. What is the general goal of the feature?
To allow a variable to be set once but only when that row of the survey is reached.

2. What are some example use cases for this feature?

  1. Timestamps ahead of each module to track time taken per module.
  2. Random number generation based on how many times a repeat group has been executed (to randomly pick one of X repeat group instances).

3. What can you contribute to making this feature a reality?
I could beta test.

Does the once() function not cover some of this functionality?

1 Like

For tracking time, take a look at lightweight timestamping and (although it may be a little more challenging to parse) you can also enable a detailed audit log.

For more details on once(), here is the relevant section of the docs:

You can get the number of times a repeat group as been executed using count(), read more here:

1 Like

Hi Dan,

Thanks for the response! I will definitely check what you say out.

As for the number of times a repeat group has been executed, I am aware of count(). This is the same as CTO which I have been using for years. What I was hoping for was something where counting the repeat group could be done at a point in the survey so that people couldn't go back and add more.

This is similar to another use case for calculate_here which is that if you want to hand a tablet to a respondent and have them fill confidential things, you can then block backing up and seeing that after they hand it to the FO in CTO. But, without calculate_here, I am unclear if this is possible in ODK.

I realize that you are all answering as volunteers and I I really appreciate you. I myself used to program in Java like more than 10 years ago but now I am just trying to keep my head above water on my current day job while also taking a challenging online course in Data Analytics and managing my two kids, one of whom is autistic. Otherwise, I wouldn't just ask for a feature but offer to help (beyond beta testing).

The fact that you guys respond to questions is amazing. Thank you!


Yes. Some of the functionality is covered as you say but not all. If all of it was covered, I would not be writing here.

Hopefully the ideas @danbjoseph has shared address the lightweight timestamping need! In general, using the trigger column lets you control when an expression is evaluated: it only evaluates if the question referenced in trigger changes. Otherwise we don't have a concept of "here" in ODK. Please keep in mind SCTO forked a while ago so their engine and the mental models they build on may be quite different at this point.

We may need more details on your scenario to guide you with the second item. Here are two potentially related tools:

1 Like