Michelle Logan Posted September 3, 2011 Posted September 3, 2011 I have been searching and all I can seem to find is how to calculate someones age from a birth date. What I would like to accomplish is a field that will show the upcoming birth date. Example: We have a D.O.B. field 9/10/1950 on the main layout. I need a field to display the approaching birth date for the current year 9/10/2011 Then next year the field would show 9/10/2012 and so on for each following year. With my minimal knowledge I have tried every calculation I can think of, all to no avail, all I can seem to do is add day to the current birth date. Can someone help with this matter? Thank you, M.Logan
comment Posted September 3, 2011 Posted September 3, 2011 See something very similar here: http://fmforums.com/forum/topic/79917-calculating-days-remaining-to-birthday/page__p__371932#entry371932
Michelle Logan Posted September 3, 2011 Author Posted September 3, 2011 Hi comment, Yes I found that one, but all I can get it to do is show me how many days left until the current year birth date. Now, my thinking is I could take that number and add it to the current date in some form? Am I thinking on the correct path? Michelle
LaRetta Posted September 3, 2011 Posted September 3, 2011 Just drop off the -d on that calc and change the calculation result to date so it would be: Let ( [ d = Get ( CurrentDate ) ; thisDOB = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( d ) ) ; nextDOB = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( d ) + 1 ) ] ; Case ( thisDOB < d ; nextDOB ; thisDOB ) ) Be sure to enable the 'do not store calculation results...' in Storage Options. In this way, it will always show the date of their next birthday.
Michelle Logan Posted September 3, 2011 Author Posted September 3, 2011 Well, that did the trick! Not sure what everything means in there but it does what I am looking for. Thanks for all the help. M. Logan
comment Posted September 3, 2011 Posted September 3, 2011 Not sure what everything means in there It would be well worth spending the time and effort to find out.
Michelle Logan Posted September 3, 2011 Author Posted September 3, 2011 Trust me I am trying, my book does not have anything like that in it. That is why I spent three hours searching the Internet for a solution and trying to incorporate them before I had to throw in the towel and come here seeking help. Thanks, M. Logan
bcooney Posted September 3, 2011 Posted September 3, 2011 A site that you might consider visiting is Brian Dunning's Custom Functions. This site is full of advanced calculations and a good way to see how the experts structure advanced calculations.
Michelle Logan Posted September 3, 2011 Author Posted September 3, 2011 Just made a visit to the site, Holy-Cow! Thanks for the link. M. Logan
comment Posted September 3, 2011 Posted September 3, 2011 I am not sure my point was clear enough. It's all right to "to throw in the towel and come here seeking help". But the help given is meant to increase your abilities. Sticking it in your solution under "don't know how, but it works" is not on.
Michelle Logan Posted September 3, 2011 Author Posted September 3, 2011 Comment, First understand that I appreciate the assistance you have provided. But I do not understand your comment to me. When you see a post from me, rest assured that I have navigated the Internet in an attempt to find a solution myself, and learn how that solution works. This is my last stop for help, I do not come here first looking for a quick and easy solution, I do not teach my students that nor do I live my life in that manner. My statement about this solution was that the book I have shows nothing close so there is no option to learn from anything similar. At no time did I say I just put it in and it works and that is the end of it. I strive to learn what makes this work, but without prior knowledge or written explanations, the only comment I could make at the time of the posting was I have no idea what all the steps do. At no time did I state that I had no intention of learning what they do, as it is my goal to know what I put in my solutions work in the event there is a problem I will know how to rectify the issue. Every FM book seems to cover the same topics, Relationships, Scripts steps, Errors, Field Names etc. the only differences I have seen is that each title progression covers some of the new features of the current release and nothing such as that I seek to discover in this calculation. So, again I appreciate the input, but I honestly believe you have read something incorrect in my posting. M. Logan Update: After thinking it over, I will not bother the board again with any of my beginner questions. I thank those who have assisted me to this point and hope that others which are at a similar level of knowledge as I, find it easier to ask as question without justification as to their intentions. Could one of the Administrators delete my account please, as I will not return.
comment Posted September 3, 2011 Posted September 3, 2011 If I said something that you find offending, I apologize. That was certainly not my intention.
LaRetta Posted September 4, 2011 Posted September 4, 2011 Hi Michelle, Comment is probably the easiest person to get along with on this entire board. When he makes suggestions, it is to help. None of us looks down on someone for being new. We know that ignorance is NOT stupidity and we do not feel superior to those asking 'beginner questions'; on contrary, you are to be commended for stepping out into new territory. You are reading too much into it; I know, I can do that too. I am not asking you to stay; that is your decision alone. But I hope you will realize that you've pegged him wrong. From an outside perspective, reading the entire thread, he was a pussy cat. Truth. This is a difficult method of communication. It is far too easy to misinterpret. Keep going. And post again when you need to. And we all will try to help as we always do. LaRetta
Michelle Logan Posted September 4, 2011 Author Posted September 4, 2011 As I was working tonight my husband asked me what was wrong. I told him that I felt that it had been assumed that I was looking for a "Quick Fix" for my FM issue I was having. He knows how adamant I am about learning FM as it will be beneficial for my job. He wanted to see the post to see if I had been correct in my assumption. When we logged back on we saw the posts from Comment and LaRetta explaining the other point. A case for both exists; my husband could see where the reply to my post could be misconstrued in my interpretation, but he could also see the statement from the other side and could see no fault. I may have jumped the gun, but at the time I had honestly spent three hours seeking a solution, I had found the solution posted by Comment and all I could do was to get a number until the next date, which was not what I was seeking. At this point I gave up and came here seeking help. The reply containing: Sticking it in your solution under "don't know how, but it works" is not on was the part I felt as if I was seeking advice without requiring any input of understanding. As you can see I do not have that many postings, so my point that I do not come here seeking quick fixes holds true. If in my haste I Criticized incorrectly, then I apologize. M. Logan
bcooney Posted September 4, 2011 Posted September 4, 2011 This forum tends to be more for beginners than other FM forums. As such, we do not expect you to spend hours trying to find an answer elsewhere. I hope you stay with us. We need more people that are looking to learn, rather than simply paste in our answers. I won't try to interpret comments reply. I did find it quite out of character*, but took it to be a motivator for you to say, "so, tell me how to break down the meaning of this calc." *He has offered thousands of dollars worth of complimentary consulting on this forum. This thread is much more typical of his tenacity and patience with a new developer.
IdealData Posted September 4, 2011 Posted September 4, 2011 And here's something we should all be doing: For your benefit Michelle I have put comments in the calculation that explain what each line is doing. In particular the Case() function has been split over several lines for readability. Comments in calculations can appear at the end of a line after "//", or as a whole line between "/*" and "*/" (/* this is a comment */) Let ( [ /* setup some variables for comparison purposes */ d = Get ( CurrentDate ) ; //set the variable d to TODAY thisDOB = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( d ) ) ; // set the variable thisDOB to the month and day of DOB and the year of TODAY (this year) nextDOB = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( d ) + 1 ) // set the variable nextDOB to the month and day of DOB and the NEXT year of TODAY (NEXT year) ] ; Case ( thisDOB < d ; // if the variable this DOB (assigned above) is BEFORE TODAY nextDOB ; // then the RESULT is the variable nextDOB thisDOB ) // otherwise the RESULT is the variable thisDOB ) Any comments? :yep:
Recommended Posts
This topic is 4887 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