Community
Showing results for 
Search instead for 
Do you mean 
Reply

Code for Calculating Age From Birthday

Accepted Solution Solved
New Member
Posts: 9
Country: France
Accepted Solution

Code for Calculating Age From Birthday

I would like to calculate the age of a person from the date field of birth is this possible?
thanks

Accepted Solutions
Solution
Accepted by topic author loidonmartine
‎10-25-2016 06:41 AM
Administrator
Posts: 416
Country: United_Kingdom

Re: Code for Calculating Age From Birthday

Provided you're using Act! v16 or later, then yes, it's absolutely possible.

 

You'll need to create a "Calculated Field" - then link this field to the Birth Date field.

 

Check out the steps below:

 

 

Create a New Field (Tools > Define Fields > Create New Field):

 

You can name this anything you like, but set the 'field type' to calculated.

 

agefield1.PNG

 

 

 

 

Set the field behaviour:

 

 

In this case - set the Calculated Field Type to 'Date'.

 

Select Birth Date as field to calculate from, and select 'Years Since Date' to have your new calculated field display the Age.

 

 

agefield2.PNG

 

All that's left to do now is to add the new 'Age' field to your layout!

 

Hope this helps!

 

 

 

View solution in original post


All Replies
Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: Code for Calculating Age From Birthday

What version of Act!? The current version allows you to create calculated fields that do just this.
Solution
Accepted by topic author loidonmartine
‎10-25-2016 06:41 AM
Administrator
Posts: 416
Country: United_Kingdom

Re: Code for Calculating Age From Birthday

Provided you're using Act! v16 or later, then yes, it's absolutely possible.

 

You'll need to create a "Calculated Field" - then link this field to the Birth Date field.

 

Check out the steps below:

 

 

Create a New Field (Tools > Define Fields > Create New Field):

 

You can name this anything you like, but set the 'field type' to calculated.

 

agefield1.PNG

 

 

 

 

Set the field behaviour:

 

 

In this case - set the Calculated Field Type to 'Date'.

 

Select Birth Date as field to calculate from, and select 'Years Since Date' to have your new calculated field display the Age.

 

 

agefield2.PNG

 

All that's left to do now is to add the new 'Age' field to your layout!

 

Hope this helps!

 

 

 

New Member
Posts: 6
Country: United States

Re: Code for Calculating Age From Birthday

How do you get this field to update? I am running ACT 18 Pro and the only way for the calculated field to update when a birthday passes is if I change the date of birth field. Am I missing something?

Administrator
Posts: 4,024
Country: United_Kingdom

Re: Code for Calculating Age From Birthday

Hi evang,

The field should update every time the record is viewed or refreshed.
I'm assuming your calculated field shows an Age. If this is not updating after the birthday has passed, I would suggest deleting and recreating the calculated field and testing the behaviour again. You could also set the field behaviour to Days since to more easily see if the value is updating correctly.
New Member
Posts: 1
Country: Australia

Re: Code for Calculating Age From Birthday

Hi I'm having the same issue; The calculated age field is not updating, even with a refresh or save, nor with deleting the birthdate and resaving. I was using Act17 Pro, and thought upgrading to Act18Pro would fix the issue, but it hasn't. Any suggestions?

Administrator
Posts: 4,024
Country: United_Kingdom

Re: Code for Calculating Age From Birthday

Hi Grant,

Could you try creating a new calculated field and linking it to your birthdate field, then setting the formula to "Days since".
Does this new field update correctly?
New Member
Posts: 6
Country: United States

Re: Code for Calculating Age From Birthday

I created a "Days Since" field and it has the same issues. Mine has not updated since I created it a few weeks ago.

Administrator
Posts: 4,024
Country: United_Kingdom

Re: Code for Calculating Age From Birthday

Hmm, perhaps the issue might be with the database. To test this, please can you open another database (either by creating a new one, or using the demo database) and create some dummy contacts with birthdays, then create a new Days Since calculated field and check to see if the field updates on this database.
New Member
Posts: 6
Country: United States

Re: Code for Calculating Age From Birthday

Thanks Gary, the days since does update in the new database I created.  Is there a way to fix my old database?

 

In my old database, the calculation for the contact age is not working but the one for the spouse age is updating properly.  I tried creating a new date field and calculated age field but that one does not update properly either...