relational databases- using a mother file field in a check for a child file field
Dear listers,
I have created a relational EpiData database where the value of a field called RECDATE is automatically passed from the mother file to the related child file. This works fine. I have a field in the child file called DATE and wish to ensure that DATE is always later than RECDATE. I have tried the following check:
date AFTER ENTRY IF DATE< RECDATE THEN HELP "The date can't be earlier than the date of recruitment" TYPE=ERROR ENDIF END END
And I get the following error:
Error in IF expression: Invalid parameters to DATE.
Does anyone have any advice on using automatically passed variables in checks? All help is much appreciated. In case it helps, here is the start of my child.chk file.
BEFORE RECORD RECDATE=varRECDATE END
id KEY 1 END
recdate NOENTER END
date RANGE 1/1/2006 31/12/2007 LEGAL 1/1/1800 1/1/1900 END AFTER ENTRY IF DATE< RECDATE THEN HELP "The date can't be earlier than the date of recruitment" TYPE=ERROR ENDIF END END
Katherine Smith Research Assistant Clinical Epidemiology and Biostatistics Unit (CEBU) Murdoch Childrens Research Institute (03) 9345 7957 katherine.smith@mcri.edu.au
Do not make a variable with the name DATE. DATE is an EpiData function name. The general rule is that you should never create a variable with the same name as is used anywhere in EpiData's syntax. Change the variable name to DxDate or RxData or IntervDate.
Jamie
Katherine wrote:
Dear listers,
I have created a relational EpiData database where the value of a field called RECDATE is automatically passed from the mother file to the related child file. This works fine. I have a field in the child file called DATE and wish to ensure that DATE is always later than RECDATE. I have tried the following check:
date AFTER ENTRY IF DATE< RECDATE THEN HELP "The date can't be earlier than the date of recruitment" TYPE=ERROR ENDIF END END
Hi Katherine,
I have just had a similar problem - it seems to be with using the word "date" which is reserved as a function in Epidata. I don't know how to get around this (maybe someone else here does) so for my database I simply changed the name of the variable to something else (e.g. vdate).
Charity
On 11/27/06, epidata-list@lists.umanitoba.ca < epidata-list@lists.umanitoba.ca> wrote:
And I get the following error:
Error in IF expression: Invalid parameters to DATE.
participants (1)
-
epidata-list@lists.umanitoba.ca