[Epidata-list] How to tell which field made a relate ?

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Thu Oct 16 15:38:24 CDT 2003


Piotr asked: 
My next problem is: if there is some way to get the name of  field in 
calculation.
I mean, I 'd like to set comment legal in relational file depended on  
reference which field was called from.
i.e.: main file has question: Which medicine have you used for last  12 
month?  And there is multiply response so  I'd like to use relational 
file. But  the next quetion is: Which  medicine ...ever used? And my 
problem is to have ONE file with the medicine, and in this file I should 
have an information about respondent, and form WHICH FIELD was calling.

------------------------------------------------------------------
Something along this line where you combine a global variable with a
comment legal depending on its value should work, some experimentation
needed: 

chk file:

before file
* note the global
define fieldname ____________ global
end


id
 mustenter
 key unique
end

v1
 after entry
   fieldname = "v1"
   relate id otherfile 1
 end
end

v2 
 after entry 
   fieldname = "v2"
   relate id otherfile 
 end
end


otherfile's chk file:
before file 
* note you can repeat a define to be able to use the file alone
define fieldname _________ global
end

id
 key
 mustenter
end


moreinfo
 before entry
  comment legal
     10 "no answer"
     11 otherfiled
  end
  if fieldname = "v1" then 
     comment legal 
        1 yes
        2 no
     end
   endif
 if fieldname = "v2" then 
     comment legal 
        11 yes
        12 no
     end
   endif
  end
end 


regards Jens Lauritsen
Jens M. Lauritsen, Consultant,MD. PhD.
The EpiData Association,                   (EpiData Foreningen)
Enghavevej 34, DK5230 Odense M. Denmark
e-mail: info at epidata.dk
For E-mail news on EpiData: Http://www.epidata.dk/php/maillist.php
EpiData is freeware




More information about the EpiData-list mailing list