Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hello,

I'm new to this forum, as I am to FileMaker, and I need a little help, because I'm not really specialised in databases.

What I'm asking is undoubtedly very simple, but I just can't seem to find a way to do it. What I need is for a field to automatically calculate somebody's age, based on the current date (obtained in one field by the Get (CurrentDate) function) and the person's date of birth, which is entered into another field.

Can some kind soul please help me with this ?

Thanks a lot,

Rob

Welcome to the Forums! smile.gif

The age/birthday function reappears periodically on the forum, so there should be some good discussion already available. Try doing a search for "birthday" in the subject line. If I remember correctly, there was also some discussion about user preferences in displaying the result.

Happy Monday!

Paul

Hi belph

Sorry, I obviously didn't mean "script", but rather the calculation for your "age" field.

Use Status(CurrentDate) instead of the Today function.

The Today function only calculates when the file is opened: if the file remains open overnight the result will be incorrect, and it only recalculates when the file is closed and opened again.

Also, any calculation that uses the Status(CurrentDate) function should have its storage set to unstored.

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

Hi Rob,

... me again ! this is what happens when you're still working at gone 0100 Hrs.

Age is a calculation field returning a NUMBER result , despite the words included in it. If you don't want to know the months and/or days components just omit the parts of the calculation you don't want.

I would use the "Today" function (which is a date in its own right) to get the current date rather than Get(Current date) as you suggested, and insert or type "Today" directly into the calculation as shown in my first post.

Hope this helps .. I'm off to bed !

CJ

Don't bother with Today; you won't find it in FM 7. wink.gif

Thanks vaughan, I didn't realise that.

The script works OK in normal use, I presume that you just replace "Today" with "Status(Current date)"

Regards

Jon.

  • Author

Hello all,

Thanks a lot to all of you, I wasn't expecting so many replies so soon smile.gif

This is a really friendly and helpful forum, thanks for having made me feel at home.

Rob

  • 2 months later...

Thanks for this calculation.

I used

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

from Queue and it worked perfectly.

smile.gif

This forum is a GREAT resource grin.gif

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.