Multiple key and change

Hi all,

My app will allow staff to log their working hours.
So I have a table with StaffID / Date / WorkSiteID / HoursWorked.
So far nothing complicated.
In order to avoid duplicated entries, i created a computed_key with StaffID / Date / WorkSiteID
So far so good.

However, when an entry is entered, I cannot change it afterwards…

I do not know how to avoid duplicates and be able to change it afterwards.

Many thanks in advance for your returns!

Matt

I don’t recommend making the computed key based off of things in the table. Best solution is to have a true key([ShiftKey] maybe) that is just a UNIQUEID() but set the valid if for the key to be if StaffID+Date+WorkSiteID is not already in the table. If any field is invalid then it will not let you save a form view so you can realistically have any field you want have this valid if.

1 Like

Hi Austin

There actually is a UniqueID for this table. However, it cannot avoid dupiclates…

A key column value cannot change once its row is saved. If a computed key is used, none of the column values used to compute the key can change, as their change would change the key column value–which cannot happen.

1 Like