2005. augusztus 13., szombat

How to iterate through both a master and a detail table


Problem/Question/Abstract:

My tables need to have master-detail relationship, but I still want to iterate through all the records in a table (detail...). My tables are:

Associate- employee name, leads, supervisor, etc...
Quality Score- associate name, etc...
Productivity Score- associate name, etc...

Obviously, these will be linked via the associate name. However, I cannot programmatically iterate through all the records after being linked. What I want to do is get the average quality score, productivity score, etc... for the team lead and supervisor. Any ideas?

Answer:

You can do something like:

{ ... }
MasterTable.First;
while not MasterTable.EOF do
begin
  while not DetailTable.EOF do
  begin
    { do your stuff }
    DetailTable.Next;
  end;
  MasterTable.Next;
end;

Nincsenek megjegyzések:

Megjegyzés küldése