Please suggest
how can we calculate years given by days using record types
Discussion posts and replies are publicly visible
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.
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.
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.
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?
That was it!!!! Thanks Simbu!!!!
https://docs.appian.com/suite/help/25.1/custom-record-fields.html#extract-partial-dates-(sync-time-evaluation)