Problem defining the key variable for a relational database
Hi there,
I have a relational database with three key variables (district_id; health facility_id; patient_id). It is relational as there are three forms: Patient Demographics, Patient Progress, Laboratory.
For the Progress form, for some reason, when try to enter the variables in the key (Right click form>Define key), I cannot add anything more than the patient_ID. The other options are greyed out. For all other forms, entering multiple variables in the key is no problem.
I'd appreciate some advice on what (obvious) option I am missing.
Thank you!
Ruwan
I assume that your structure is like this:
Demographics form \—> Progress form (1-many) \—> Laboratory form (1-many)
Once you define a key(s) in demographics, it automatically defined for the child forms because it(they) define the relation. When you define a new key in progress, they key or keys you defined for Progress show, but are greyed out because you cannot remove them. So in progress, you can add a new key, which will be automatically defined for laboratory.
You MUST know what your relationships and keys are before you start. Once you have created a subform, you cannot change the keys in the parent form. I find it best to set up the data forms with just the keys and maybe a couple of other fields first, to make sure the structure works for you. You can defined the type of relationship (1-1 or 1-many) and try out the flow of data entry from one form to another and back again.
Then add in the rest of the fields.
Jamie
On May 23, 2017, at 17:10, EpiData development and support epidata-list@lists.umanitoba.ca wrote:
I have a relational database with three key variables (district_id; health facility_id; patient_id). It is relational as there are three forms: Patient Demographics, Patient Progress, Laboratory.
For the Progress form, for some reason, when try to enter the variables in the key (Right click form>Define key), I cannot add anything more than the patient_ID. The other options are greyed out. For all other forms, entering multiple variables in the key is no problem.
I'd appreciate some advice on what (obvious) option I am missing.
participants (1)
-
EpiData development and support