Keep track of Patient

Hi, Im trying to keep track of patients in my app, but every time i enter a new entry it says the key already exists. How can I fix it? Im trying to keep track of each patients visits to the hospital.

Anybody help me?

I suggesto to use a string column for holding the key values of your table. Hide it everywhere in the app, and let AppSheet give it a value when you create a new record.
How? In the column definition of your key, use the formula UNIQUEID() in the field initial value.

2 Likes

Hi @zacc_oraro ! First, just to point out that this post really belongs in the Questions category. You’ll get a lot more eyes on your post and additional feedback there. @steve

The suggestions by @perissf will help you remove the duplicate key problem. But I am wondering how your app is designed?

What you would want to do for the use case you described is have two tables - Patients and Visits - then make Visits a child of the Patients table. This allows you view and add visits for each patient without having to re-enter patient info on each visit.

This article will give you more details. Scroll down to “Expressing Ownership Between Tables”

4 Likes

Thank you for your help. It sees not working.

Here is the structure of my app. I have 3 tables; 1. Medical Statement, 2. Treatment, 3. Appointments. The tables , Treatment and Appointment are referencing to the Medical Statement table. I want to be able to see a record of a single patient from the medical Statement table and will also have the treatment and appointment records in the inline view. I hope this is a bit clearer. (Note: English is not my language so Im struggling to explain)

In the details view I would like treatment table to show multiple records of the same patient.

1 Like

I see the Add button in the image on the right. What happens when you add new Treatments?

Thank for your responds. It opens a form to enter new patient that shows in the medical statement table. But when I add a new record in the inline table it says Key already exists. How can I fix that?