Some background:
Employer_Benefits is a sort of "parent" table with several related "child" tables (AgeFactors, Benefit_Volumes, Drug_Cards, etc). For each record in Employer_Benefits there may be none, one or many in the children, depending on the type of the parent record (for example, Age Factors has information if the Benefit is Basic Life, but nothing if the benefit is Health. On the other hand, Drug Cards are irrelevant to Life Benefits).
I need to go create a procedure that will do the following and I'm not quite sure of the syntax:
For Employer_Benefits with some criteria (e.g., EmployerKey = 42001)
Select related records in AgeFactors
Do something to them or with them
Select related records in Benefit_Volumes
do something to them or with them
and so on....until all Employer_Benefits with a key of "42001" have been taken care of.
The linking fields between the two tables may not be the same (e.g., AgeFactors doesn't use the same key fields to link to Employer_Benefits as Benefit_Volumes).
I don't mind creating several procedures do this instead of one large one, but any pointers on the XBasic syntax or overall approach would be helpful.
I've been playing around with this for a while and I think I've been going about the wrong and inefficient way. It shouldn't be this difficult to grok and code :)
I need to do this several times throughout the application, btw.
As usual, thanks in advance to all suggestions.
Employer_Benefits is a sort of "parent" table with several related "child" tables (AgeFactors, Benefit_Volumes, Drug_Cards, etc). For each record in Employer_Benefits there may be none, one or many in the children, depending on the type of the parent record (for example, Age Factors has information if the Benefit is Basic Life, but nothing if the benefit is Health. On the other hand, Drug Cards are irrelevant to Life Benefits).
I need to go create a procedure that will do the following and I'm not quite sure of the syntax:
For Employer_Benefits with some criteria (e.g., EmployerKey = 42001)
Select related records in AgeFactors
Do something to them or with them
Select related records in Benefit_Volumes
do something to them or with them
and so on....until all Employer_Benefits with a key of "42001" have been taken care of.
The linking fields between the two tables may not be the same (e.g., AgeFactors doesn't use the same key fields to link to Employer_Benefits as Benefit_Volumes).
I don't mind creating several procedures do this instead of one large one, but any pointers on the XBasic syntax or overall approach would be helpful.
I've been playing around with this for a while and I think I've been going about the wrong and inefficient way. It shouldn't be this difficult to grok and code :)
I need to do this several times throughout the application, btw.
As usual, thanks in advance to all suggestions.
Comment