Can we Update Entities using a second form

1. What is the issue? Please be detailed.
Hi dear fellows,
I have a scenario, where two forms contribute to 1 Entities data set.
How can we ensure that the second form updates the data in a previously created entity?

For instance, there is a Farmer that mention that they have sold a product. It creates an entitity in a dataset Sales with a Transaction ID.
This entity is used by a middleman in another form, who picks a Transaction ID and acknowldge that he/she has bought that product. Middle man form uses the same Transaction ID and updates value to Sales dataset.

However, I have noticed that it doesnt update the same transaction (although uniqueTransaction ID is same), rather it either creates a new entity or doesnt show changes.

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.

We are currently working on updates to entities using forms. This functionality should be available in Central by the end of the year. This is one of the most complex parts of the entity model we've established because multiple submissions could come from offline users who try to modify the same properties. We want to make sure we handle this and communicate it to users in a thoughtful way.

Entity updates are convenient because they let you have a single place to look for the latest state. However, you can accomplish anything you could with updates by using multiple entities across the same or multiple datasets, it's just that the queries to use those multiple entities in forms will be more complex and slower.

In your example, it sounds like what you'd like to be able to do is to have a confirmed property on each sale that the second form would set to yes (or 1 or whatever value you'll look for later). That's coming but is not implemented yet. For now, what you could do is create a second dataset called something like confirmations. The confirmation form would read from the sales dataset and write to the confirmations dataset. You probably only need to save the name of the sale in that second dataset. Then you could do things like when you display sales in the first form, filter out those that have already been confirmed. You'd do this by attaching the confirmations dataset to your sales registration form.

1 Like

Thank you very much for such a detailed response. Now I totally see the complexity associated, after reading your reply.

But your feedback has given me an idea as well to create a workaround for my case, i will try that.

Once again, thank you very much for the detailed reply and prompt response.

All the best and more power to you.

1 Like

Apologies for a follow up question, I have been trying it in different ways but couldnt succeed. Can you please help me with this:

I have two csv files beign generated from Entities in two different Datasets.
First is called farmer_sales.csv and contains transaction_id, farmer_name as columns. It contains all the transactions.
In the second csv, called confirmations.csv, we have transaction_id, status. Its a subset of farmer_sales.csv in its size and content.

I want to create a select_one question to list transaction_id from farmer_sales.csv where no value matches with the transaction_id given in confirmation.csv.

Thank you very much for your support.

The best way I believe we have to avoid duplicates currently is to join all the existing values and then to use selected in a choice filter to filter out ones that already exist. This is not very performant but it should be workable for thousands of entities using recent devices.

How many transactions are you looking to track? If this is intended to be an open-ended tool, how many would be a good target for a 6-month period? Indeed, updates will make this much easier to represent in a way that is fast!

Here are some sample forms that should illustrate the idea:

Notice that the confirmation form attaches the confirmations list that it also adds to using csv-external.