Why is my submission with a barcode id as the Entity id failing to update the appropriate Entity?

Welcome, @Luke_w!

Currently, ODK doesn't have a built-in concept of a "natural id" -- an id that is unique based on the specific domain that you're working in. That means that for now, all matching between Entities must be done using system ids. System ids are available through the name property because that makes them easy to use in selects. When using a natural id like your barcodes, you have to look up the corresponding name value for the identified Entity and this is the value you need to use for entity_id.

After your question of type barcode, you can add a question of type calculate that will be used to translate from a barcode to a system id.

Give it a name like system_id and then specify a calculation of instance('petri_samples')/root/item[sample_ID=${sample_barcode}]/name.

Then the really important thing is to change the entity_id on the entities tab to ${system_id}.

We know this feels quite manual currently! We've opted for maximum flexibility at first but there's definitely a usability tradeoff. We hope to eventually make it possible to specify that a certain property is a natural identifier to simplify some of this.

When you have a moment, we'd love to learn more about what you're working on in the introduction thread.

1 Like