How do I create a form to edit existing Entities values?

I'm also a bit stumped with updating an entity.

As a bit of background we run a vet clinic in Kenya, owners bring their donkeys but don't always have all the information on the first visit so we need to update their details when they return.

It's split across two forms, one for registering on the first visit and one for updating the information when they bring it on their second visit.

I'm trying this on enketo, central version v2024.1.0 Here are my two forms

Owner Details Update.xlsx (32.6 KB)
Owner Registration.xlsx (33.7 KB)

And here is the entity:
Owners.csv (461 Bytes)

Hi @Stuart! It looks like you want the "details update" form to show existing data and give data collectors a chance to edit it, is that right?

If I got that intent correctly, here's an update form that should point you in the right direction: Owner Details Update-HM.xlsx (27.4 KB)

The two key changes I made are:

  • Use the Entity system ID in the entity_id column of the entities sheet. To do this, I also changed the select_one_from_file parameters to use the default value which is that system ID.
  • Use dynamic defaults to set the values of all form fields based on the corresponding Entity values. The idea is that if the existing_participant value changes, we want every form field that is Entity-related to be updated to match that Entity's value. This is currently a bit tedious to express. I put ${existing_participant} in the trigger column for one question and then copied that down. Then I formulated the lookup expression for one field, copied that down, and changed the last part to match the Entity property I want to look up in each case.

Here are some higher level workflow questions you may find helpful to think about. Can data collectors update details indefinitely or is the expectation that they do this at most once for a specific individual? I'm seeing two different concepts possibly emerging: the owners themselves and a visit to an owner. Those can absolutely be flattened into a single concept but it should be a conscious decision -- if you only store the latest visit's info on the Entity and you want to figure out historical trends in analysis, you'll need to do this analysis work on submissions, not Entities.

I also wasn't totally sure what your intent with Owner_ID is. Maybe you could use the system-assigned ID instead of creating your own? If you want to get the system-assigned ID into the registration submission, you can do that with a calculation of /data/meta/entity/@id. This thread may be helpful to you: In analysis, how can I connect an Entity registration form's submissions to follow-up form submissions?

Hi @LN,

Thank you so much for looking at this, it works perfectly and is exactly what I was after :slight_smile:

The idea is that the vet staff can update the details indefinitely regarding change in phone number, but fields like personal ID number and Owner Name will stay the same once entered. We may occasionally encounter the case that firstly a child brings a donkey to the hospital, but the second visit an adult brings the donkey to hospital so then all details need to be changed.

The Owner ID column was left over from me doing some testing and I’ll switch to using /data/meta/entity/@id as it'll be much cleaner.

This is all very much in the alpha testing phase to see how the workflow is going to operate on the ground so there are quite a few unknowns at the moment, but this will give us a great foundation to build on.

Thank you from me and the donkeys :grinning_face:

Stu

1 Like