Updating and creating entities with one follow-up form

I'm sorry @dast, I see I never got back to you in this thread!

@MinimalPotato is right that the (terrible) error message Instance referenced by instance(Trees)/root/item/__version does not exist implies that the Trees Entity List is not attached to the form. If in your case it's appropriate to show Entities in a select, the approach @minimalpotato described with select_one_from_file would be a good one.

It looks like what you had been trying to do is generate an ID within your form and use that to make an update without having the Entity List attached. That's not currently something you can do. If you can change the structure to use a select, that will be your simplest approach. If it makes more sense in your scenario to look up the right Entity to update based on a calculated ID, you could use csv-external to attach the Entity List without a select. I think that you'll find this documentation helpful.

In order to update an Entity, you need to have its system ID. If you want to use an ID that's calculated or scanned from a barcode, you'll need to look up the system ID based on another property's value. The system ID is accessible through the name property (this is to make it easy to build selects on Entity Lists). You will need a calculate that looks something like

instance("trees")/root/item[barcode_id = ${barcode_id}]/name

You will then reference that value in the entity_id column on the entities sheet.

Here's another thread discussing this: Why is my submission with a barcode id as the Entity id failing to update the appropriate Entity? - #2 by LN

1 Like