raycock Posted January 17, 2005 Posted January 17, 2005 I already have the calculation for age but I want the calculation to appear in months instead of years so that I can figure out Vacation Time. Example: Current Date = field 1 Date of Hire = field 2 Total Months = field 3 (Calculation that I can't figure out) Vacation = field 4 (calculation = vacation *.875) in months Thanks in advance for all your help
RalphL Posted January 17, 2005 Posted January 17, 2005 Try this: Case( not IsEmpty(Current Date) and not IsEmpty(Date of Hire) and (Current Date >= Date of Hire) ; 12 * (Year(Current Date) - Year(Date of Hire) - ( Current Date < Date( Month(Date of Hire) ; Day(Date of Hire) ; Year(Current Date) ) ) ) + (Mod( Month(Current Date) - Month(Date of Hire) + 12 - ( Day(Current Date) < Day(Date of Hire) ) ; 12 ) ) )
raycock Posted January 18, 2005 Author Posted January 18, 2005 Thanks Ralph, will try it and let you know.
raycock Posted January 19, 2005 Author Posted January 19, 2005 Ralph, I tried it and when I put in the current date of 06/01/2000, it comes up 47 months. That is about 6 months short. There has to be a way. I copied exactly the calcuation and pasted it into the field and that's what I got.
RalphL Posted January 19, 2005 Posted January 19, 2005 I get 55 months with the calculation copied from the post and pasted into FMP. 6/1/2000 to 1/1/2001 is 7 months. 1/1/2001 to 1/1/2005 is 4 years = 48 months. 48 + 7 = 55. 6/1/2000 is Date of Hire & Current Date is 1/19/2005.
raycock Posted January 19, 2005 Author Posted January 19, 2005 I must have something else wrong then. I keep coming up with 47 with the exact same script. Like I said, I cut and pasted it into the field and that is what I get. Will look at it again.
RalphL Posted January 19, 2005 Posted January 19, 2005 How are you getting the Current Date? I used Get ( CurrentDate ).
raycock Posted January 20, 2005 Author Posted January 20, 2005 That is what I was using also but when I put in the field to show up the current date is was 8 months. I deleted the field and put it back in and it is now working perfectly. I guess that it was just some sort of bug. Not sure what was going on with this as it has happened before with other dates. Thanks Ralph. Your calculation did work in the first place. I should have checked into this first.
RalphL Posted January 20, 2005 Posted January 20, 2005 Have you set the current date to be unstored? It needs to be unstored or it will remain at the date the record was created.
Recommended Posts
This topic is 7316 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