Calculated field based on values from previous form entries

1. What is the problem? Be very detailed.
I'm trying to use ODK or ODK X for a maintenance inspection routine where total pump hours and total volume pumped are recorded. It is very important for the operators to be able to see the hours the pump has ran since the last inspection, and the volume pumped since the last inspection.

For example:

November 15, 2019 Inspection of Pump 1:

  • Total hours: 1,500 (hours) ... operator input
  • Total volume pumped: 5000 (cubic meters) ... operator input

November 16, 2019 Inspection of Pump 1:

  • Total hours: 1,510 (hours) ... operator input
  • Total volume pumped: 5500 (cubic meters) ... operator input
  • Hours ran since last inspection: 10 (hours) ... calculated from (Nov16 total hours - Nov15 total hours)
  • Volume pumped since last inspection: 500 (cubic meters) ... calculated from (Nov16 total volume - Nov15 total volume)

And so on for the rest of the inspections.

I'm looking for help regarding the "hours/volume since last inspection" field.

2. What app or server are you using and on what device and operating system? Include version numbers.*

I'm open to using any of the ODK or ODK x tools

3. What you have you tried to fix the problem?

I've currently installed and tried setting up the ODK tools but cannot find a way to reference previous form entries. Am currently experimenting with ODKx tables to see if a calculated column can be added.

4. What steps can we take to reproduce the problem?

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

Appreciate your time :slight_smile:

You will probably need something along the lines of a longitudinal survey - ie repeated 'inspections' against a fixed asset (pump) which would track total pump hours and volume, data which would then be available for viewing and/or calculations each time you go out and do a re-inspection. Adding longitudinal survey support for the ODK tool suite was a major topic of conversation at the recent convening; see notes here.

1 Like

Thanks for your reply. Your description of longitudinal surveys sounds like great addition to the platform!

Hi @Andre_van_den_Berg!

Longitudinal data collection is very doable in ODK-X. Your pumps actually sounds a bit like the inventory management (refrigerators) example in the docs:

1 Like

Hello @Andre_van_den_Berg,

We are achieving this in ODK on a number or projects by:

  1. Hosting our own Aggregate servers to that we have access to the database to create triggers etc
  2. Building the forms to reference csv files for previously observed data
  3. Automatically creating the csv files when data is submitted
  4. Refreshing the form with the new data when it is loaded.

Let me know if you would like some more information.


Hi @Paul_Storry,

Thanks for your response. I would love some more information!


1 Like