Re: how to show that there is a detail record




Thank you, very helpful, but how can I do this during run time? Because
I/the user can use slightly different databases. I read the commandtext
from an ini-file when the program opens the database.

Thank you very much

You can write code like this to add persistent fields and a calculated field

var
f : TField;
i : integer;
begin
Query1.FieldDefs.Update
Query1.Close;
for i := 0 to Query1.FieldDefs.Count - 1 do
//create persistent field that do not exist
if Query1.FindField(Query1.FieldDefs[i].Name) = nil then
Query1.FieldDefs.Items[i].CreateField(Query1);
//create a calculated field
f := TStringField.Create(Query1);
f.Name := 'Query1CalcField';
f.FieldName := 'CalcField';
f.DisplayLabel := 'CalcField';
f.Calculated := True;
f.DataSet := Query1;
Query1.Open;
end;

--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.



Relevant Pages

  • Re: Fields not available after recordset is opened
    ... >Does this mean that I can't have a calculated field when I'm selecting from ... But you will have to define persistent fields for each table and the ... f.DisplayLabel:= 'CalcField'; ...
    (borland.public.delphi.database.ado)
  • Re: Fields not available after recordset is opened
    ... >>Does this mean that I can't have a calculated field when I'm selecting ... But you will have to define persistent fields for each table and the ... Prev by Date: ...
    (borland.public.delphi.database.ado)