Jump to content

This topic is 7473 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am attempting to create a formula to automatically obtain a person's age from their date of birth. I have three fields: Date:(today's date), D.O.B., and Age:. I need the age to be automatically calculated after the user types in the patient's date of birth (D.O.B.). I know this can be done, I am just not sure of how to go about setting it up. Can someone out there help?

I have attached a copy of my db if anyone cares to take a look.

Dave

EKGSTRESSTEST-6Copy.zip

Posted

Dont need the db.

Here is what you are looking for.

 GetAsText(Year(Get(CurrentDate)) - Year(DOB) - Case(Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))); 1)) 

Result is an unstored number.

Posted

I've been looking for this calc also and ty for publishing it but it doesn't make me older after this year's birthday.

eg DOB is 9/30/1967 it caculates 36 which is correct.

But if i change the DOB to 11/30/1967 it still calculateds 36.

??

Posted

it doesn't make me older after this year's birthday.

eg DOB is 9/30/1967 it caculates 36 which is correct.

But if i change the DOB to 11/30/1967 it still calculateds 36.

??

What's wrong in staying 36yo another 2 months???

Obviously this calc won't get you older as long as your computer clock doesn't hit the limit.

Change [color:"red"]your birthday into today or [color:"red"]your clock into your birthday and you'll see you're getting older (not necessarily wiser) right now... Got it?

tongue.gif

Posted

After pulling out what is left of my hair, I finally got the age/dob thing to work. My problem was that I had not set both the date and dob fields as dates. When I did that and added the below formula to the Age: field, everything worked like a charm.

Int((Date - DOB) / 365)

Thanks to those who tried to help me.

Dave

Posted

A slight mod: you don't need the GetAsText or Case statement.

Year(Get(CurrentDate)) - Year(DOB) - (Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))))

Posted

I finally figured it out: the simple way to do it is in the Age field, place the formula: (date-dob)/365. Make sure that both the date and dob fields are set as "date" fields and not as NUMBERS -- or anything else!! (this make the whole thing gibberish!!! Also, make sure the Age field is set as a number! Otherwise, you get some very strange calculations....

By the way, it doesn't seem to matter how you format the date and dob fields (either with slashes or dashes) Both seem to work equally well.

Thanks to all who offered suggestions.....

Dave

Posted

As Logixx has already stated, your calculation will not give you the correct age all the time. Dividing by 365 is not a proper way to determine it. You should use the calc above.

Posted

As Logixx has already stated, your calculation will not give you the correct age all the time. Dividing by 365 is not a proper way to determine it. You should use the calc above.

I agree... the previously mentioned solution will work well - I've also found this to be a useful Auto Enter Calculation for the Date of Birth.

This corrects the tendancy for users to enter a two digit year, it takes it to the previous century if the two digit year would result in a date beyond todays date.

DOB = If(DOB>Get(CurrentDate); DOB-(36525) ; DOB)

And then...

Age = If(IsEmpty(DOB); Age; Year(Get(CurrentDate)) - Year( DOB) - (Get(CurrentDate) < Date(Month( DOB); Day( DOB); Year(Get(CurrentDate)))))

Posted

I'm looking for a calc that will give me the difference between the a timestamp field in two related records (it's a billable time db). I just need to know how much time to bill using the info. The records are related by a job# field. I'm working in FM7.

I've tried using a summary field in the related table, and no luck with it so far. I know I'm missing something simple, but damned if I know what it is! : Any help is truly appreciated!

TonyO

This topic is 7473 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.