Scrimshaw Posted September 10, 2014 Posted September 10, 2014 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
Lee Smith Posted September 10, 2014 Posted September 10, 2014 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.
comment Posted September 10, 2014 Posted September 10, 2014 It is both unnecessarily complicated and inaccurate (not taking in account the month and the day), but still - what's "not working"?
Scrimshaw Posted September 11, 2014 Author Posted September 11, 2014 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.
comment Posted September 11, 2014 Posted September 11, 2014 Make sure that the field is a calculation field and that it is set to 'Do not store calculation result...' in Storage Options.
Scrimshaw Posted September 11, 2014 Author Posted September 11, 2014 Thanks very much, setting that option has fixed it. I really appreciate your time and knowledge
comment Posted September 11, 2014 Posted September 11, 2014 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.
Recommended Posts
This topic is 3783 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 accountSign in
Already have an account? Sign in here.
Sign In Now