Skip 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.

Calculate years

Featured Replies

Some years ago I took a standard inventory file and have used it since. It is very good. You enter the date purchased and one of the fields calculates the age in years. It is not working and the formula is beyond my expertise. This is the formula;

If(

GetAsText( Year(Get(CurrentDate)) - Year(Date Purchased) ) = "1"; 
GetAsText( Year(Get(CurrentDate)) - Year(Date Purchased) ) & " Year"; 
GetAsText( Year(Get(CurrentDate)) - Year(Date Purchased) )
)
 
I would be grateful if anyone could advise what changes I should make to get the field to work properly. Thanks

Hi Scrim, and welcome to the FM Forums,

 

I moved your topic from "FileMaker Pro 11" to "Calculation Engine (Define Fields)” because the General topics are reserved for discussion of the new tools, features, and functions that were new in that release of FileMaker, and not for asking how-to questions.

It is both unnecessarily complicated and inaccurate (not taking in account the month and the day), but still - what's "not working"?

  • Author

The field that should show age, is not showing anything at all, and for entries made some years ago, it is not giving the correct answer.

Make sure that the field is a calculation field and that it is set to 'Do not store calculation result...' in Storage Options.

  • Author

Thanks very much, setting that option has fixed it. I really appreciate your time and knowledge

Now that you have that fixed, I suggest you change the formula to a much more simpler =

Year ( Get (CurrentDate) ) - Year ( Date Purchased )

and set the result type of the calculation to Number. Having the units in the same field as the numeric value is not good practice.

 

 

Note that we are assuming here that this is a fiscal calculation (i.e the exact date of the purchase is irrelevant), and that your fiscal year corresponds to the calendar year. IOW, an item purchased on December 31, 2013 is one year old on January 1, 2014.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.