[EpiData-list] preventing duplicate entries

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Mon Nov 23 14:13:52 CST 2009

I am entering daily visit counts to walk-in clinics in our area. There 
are 6 clinics or sites. So a record is uniquely identified by site and 
date. Is there a way to prevent the entry of records with a site-date 
combination that duplicates a site-date combination that already exists 
in the database?
The easiest is: - assume your file name is walk_in.rec and walk_in.qes

0. make a backup of your data to some other media or drive
1. add a text field (fldcontrol), e.g. length 75 to your walk_in.qes 
file at the bottom.
2. open the file walk_in.rec for entry
3. entry will ask you to update your rec file with changed structure.
       accept this with a "yes/ok"
4. close the file without entering any new records
5. add to the chk file the following:

     assuming your first field is site and second field is clinic number:

  after entry
    fldcontrol = string(site) + "-" + string(clinic)

  key unique

If you enter any again a warning will come out automatically since the 
key unique is tested at assignment of the value, not at the field (which 
is never entered).

Let us know on the list whether this works.

Jens Lauritsen

More information about the EpiData-list mailing list