Community
Showing results for 
Search instead for 
Do you mean 
Reply

Creating calculated Date fields

Copper Elite Contributor
Posts: 82
Country: Canada

Creating calculated Date fields

[ Edited ]

Hi all,

 

Does anyone have some sample code that creates a calculated date field? Such as an Age field?

 

I am using some starter code from here: https://community.act.com/t5/The-Act-Journal/Act-Calculated-fields-SDK-Primer/ba-p/247844

 

I can create numeric fields with normal math functions without any issues, but I am not sure how to set up a field that relies on date.

 

I tried using the following for the ColumnCalDefinition, but I always get a negative value back, and in ACT, the field does not show as a regular calculated date field.

 

fd.ColumnCalDefinition = "datediff(day,getdate(),[BIRTHDATE])/(365.242199)";

 

Any help would be appreciated.

 

Thanks,

Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

Copper Super Contributor
Posts: 478
Country: Australia

Re: Creating calculated Date fields

Act now has calculated fields built into the program why not use them to create a age field?

Jason Dawson Financial Planning
Brisbane | Australia - JDFP Home Page

Act Ver - Act! Premium Version 17.1.169.0, Hot Fix 3
OS - Windows 7 (stand alone machine)
MS Office - Enterprise 2007
Phone - Samsung Galaxy s6