Subject Re: [IBO] displaying Calculated Fields in TIB_Grid
Author Andreas Pohl
IB_Query1.CalculatedFields.Text:='DUE varchar(10)'+#10+'DUE1 Integer';

1. string field for displaying a calculated date
2. integer/boolean field for displaying calculated checkbox

In IB_Query1.OnCalculateField:

var d:TDateTime;i:Integer;
begin
inherited;
with AField do
if FieldName = 'DUE1' then begin
if ARow.ByName('StartDate').IsNull or
(ARow.ByName('Turnus').AsInteger<1) then begin
AsString:='';
ARow.ByName('DUE').AsInteger:=0;
end
else begin
d:=ARow.ByName('StartDate').AsDate;
i:=ARow.ByName('Turnus').AsInteger;
while d<date do d:=d+i;
AsString:=FormatDateTime('dd.mm.yyyy',d);
ARow.ByName('DUE').AsBoolean:=( (d>=date) and (d<=date+7));
end;
end;
end;

Note: Startdate,Turnus are "real" fields

Mit freundlichem Gruss & Best Regards

Andreas Pohl
apohl@...
www.ibp-consult.com
----- Original Message -----
From: <alvin@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, May 02, 2001 10:23 AM
Subject: [IBO] displaying Calculated Fields in TIB_Grid


> I'm having trouble displaying Calculated Fields in TIB_Grid,
> i have an empty table, when i add a record, the calculated fields
> are correctly displayed, but when i add again another record, the
> value of the calculated fields of the second record display in the
> grid will also be the value of the first record???
>
> Is there anybody can give me a brief example/code of displaying
> Calculated Fields in TIB_Grid??? thanks a lot...
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>