Subject Re: How to calulate field value in a Grid?
From Gaetano D. <gaetanoddRemoveThis@andThatHotmail.com>
Date Sat, 31 Jul 2021 04:56:30 +1000
Newsgroups dbase.getting-started

On 30/07/2021 22:54, Milind Nighojkar wrote:
> I have a calulated field in a grid.
> Scenerio :
> Field \'Aging\' which is calulated based on Date() - 'Estimated_Date'
> How to calulated Aging in a Grid Form when it opens and when 'Estimated_Date' is changed
> Regards
>
> Milind Nighojkar
>
Hi Milind,

dateEx.cc in dUFLP has an age calculation as of today function by
supplying a date of birth or an Age2() function  which takes two dates
and calculates age between the two supplied dates:

FUNCTION Age( dBirth )

RETURN ( floor( ( val( dtos( date() ) ) ;
                   - val( dtos( dBirth ) ) ) / 10000 ) )


FUNCTION Age2( d1, d2 )

RETURN ( floor( ( val( dtos(d2) ) ;
                  - val( dtos(d1) ) ) / 10000 ) )

HTH

--
Gaetano.