[EpiData-list] Q on jumping between fields from related tables

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Mon Jul 3 12:16:18 CDT 2006


You can probably do this by just having a second RELATE to the child 
file in the .chk for the parent file. However, with the second RELATE 
command you'll go to a new record, rather than back to the one you were 
just working on. At data entry, you could then navigate back to the 
record you were working on. I'm sure this could be somewhat automated, 
but you take a big risk in doing so if you are just reviewing data and 
not entering it. You might want to have a separate .chk for use when 
reviewing data.

Another approach will be to duplicate, in the child file, the parent 
fields you want to go back to enter. These can be entered without 
interrupting the flow of data entry when you need to (and ignored for 
child records that don't call for returning). As the fields are entered, 
you assign them to a series of GLOBAL variables (defined in both the 
parent and child .chk files). Then when you finally return to the parent 
record, you can assign the values stored in the GLOBAL variables to the 
appropriate fields in the parent file. For examples of passing values 
via global variables, look at the HOUSE-PERSON-VISIT files in the 
EPIDATA\SAMPLES folder. With careful attention to what is in the global 
variables you pass back and forth, you can tell whether anything was 
entered via the child data entry screens. Some suggestions:
- give the global variables (e.g. GVAR1) special values before the 
RELATE command
- check for this value when you return
- assign null or missing values, if you want, to these child fields once 
you have stored the values in the global variables; be sure to ignore 
these fields in your analysis. You can always get rid of them 
permanently before analysis by revising the .qes file and making a copy 
of the child file.

---- parent.chk ----
DEFINE gvar1 ____________ GLOBAL

  key unique 1

  gvar1 = "notentered"
  relate parentid child.rec
  if gvar1 <> "notentered" then
    VARB = gvar1
---- end of parent.chk ----
---- child.chk ----
DEFINE gvar1 ____________ GLOBAL

  key 2

  if varc = "Y" then
    goto parentvar1

  gvar1 = parentvar1
  parentvar1 = ""
  goto VARD
---- end of child.chk ----

Again, it will be best to have a different .chk file for just reviewing 
the data as you may not want to be changing values.
There are multiple ways to set this up depending on what your data looks 

In general, jumping back and forth, either on paper, or in software like 
EpiData, is a temptation for error. Data entry works best when there is 
a clearly defined flow. It's always easier to figure this out with the 
actual .rec and .chk files than to be guessing what you want. Best of luck!

Jamie Hockin
Public Health Agency of Canada
> Hi,
> Would anyone be able to help me figure out how I can jump from one 
> field in a child table to a parent table and back?  I have related two 
> files and depending on how the survey questions are answered, I need 
> to be able to go from the child file to the parent table and back.  It 
> doesn't seem as if the jump function allows one to jump from one field 
> in one table to another field in a different (but related) table.
> Any help would be greatly appreciated.
> Regards,
> Thao

More information about the EpiData-list mailing list