Skip to main content

6 replies

stefanhelzle0001
Brainy
Jan 23, 2023 11:57 AM UTC

That function returns an interval as described in the documentation. Turning that into an integer returns the number of days. Divide that by 365 and you should get a not very reliable age.

davel001150
Inspiring
Jan 23, 2023 2:16 PM UTC

Days / 365.25,

It will be off by 1 day in most cases because of the year 2000, which wasn't a leap year.  Don't know how to factor that in, but this is honestly already more accurate than you need.

chrisg0006
Inspiring
Mar 17, 2025 3:07 PM UTC

I did a very similar sort of thing, except now, I have an issue with decimals.

I have a table of clergy members with birth dates (clergydob) and the date they died (clergydod).  

I couldn't use a Sync-time evaluation because I need the Today() function.  So, I created a Real-time evaluation custom field called Age.

a!customFieldDivide(
a!customFieldDateDiff(
    startDate: 'recordType!CMS Clergy Member Status Report.fields.clergydob',
    endDate: a!customFieldDefaultValue(
        'recordType!CMS Clergy Member Status Report.fields.clergydod',
        today()
        ),
    interval: "DAY"
    ),
365.25
)

Now, how do I round down?  It seems that the function rounddown() is not compatible with a custom field no matter when defining the field, or when displaying its value.  I tried to use it in the List column.

a!gridColumn(
  label: "Age",
  sortField: 'recordType!CMS Clergy Member Status Report.fields.Age',
  value: rounddown(fv!row['recordType!CMS Clergy Member Status Report.fields.Age'],0),
  align: "CENTER"
)

I received the following error message.

Expression evaluation error at function a!gridField_23r3 [line 51]: A grid component [label="null"] has an invalid value for "columns". A grid column [label="Age"] has encountered an error. Expression evaluation error at function 'rounddown' [line 81]: A null parameter has been passed as parameter 1.

silambarar921604
Participating Frequently
Mar 17, 2025 3:12 PM UTC

The error seems like the value is null at fv!row['recordType!CMS Clergy Member Status Report.fields.Age'].

Could you please do a null check before using the function and test?

chrisg0006
Inspiring
Mar 17, 2025 3:26 PM UTC

That was it!!!!  Thanks Simbu!!!!