Subject Re: [IBO] Re: Example of CalculateFields !
Author Kostas Rizoudis
Hi,

try this:

if (AField.FieldName='DAYS')then
begin
AField.AsInteger := DaysBetween(aRow.ByName('MY_DATE').AsDate, Date);
end;{if}

regards,
Kostas






--- In IBObjects@yahoogroups.com, "Joao Henrique Levada" <joaolevada@...> wrote:
>
> --- In IBObjects@yahoogroups.com, "mmusetti70" <mmusetti70@> wrote:
> >
> > Hi, in my table I have a field DATE. How do the difference between the current date and the field DATA using CalculateFields ?
>
>
> You need to declare the calculated field metadata on CalculetedFields property, like:
>
> DAYS INTEGER
>
> So, on the OnCalcFields event, you can fill the value:
>
> IB_Query1.FieldByName('DAYS').AsInteger := DaysBetween(IB_Query1.FieldByName('MY_DATE').AsDate, Date);
>
>
> Don't try just copy and paste this code. This is a tip.
>
> See ya...
>

Well, I did like you showed, but it works with only first record. What's wrong ?

Thanks for your help,

Marcos




[Non-text portions of this message have been removed]