April 1, 20169 yr Hi there, I am developing an HR system. I have a field that calculates the employee's employment age in the following format: "1 day, 1 month, 1 year": "GetAsText ( Year ( Get ( CurrentDate ) ) - Year ( First date of employment ) - If ( Get ( CurrentDate ) < Date ( Month ( First date of employment ) ; Day ( First date of employment ) ; Year ( Get ( CurrentDate ) ) ) ; 1 ; 0 ) ) & " Years, " & GetAsText ( Mod ( Month ( Get ( CurrentDate ) ) - Month ( First date of employment ) + 12 - If ( Day ( Get ( CurrentDate ) ) < Day ( First date of employment ) ; 1 ; 0 ) ; 12 ) ) & " Months, " & GetAsText ( Day ( Get ( CurrentDate ) ) - Day ( First date of employment ) + If ( Day ( Get ( CurrentDate ) ) ≥ Day ( First date of employment ); 0 ; If ( Day ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) ) < Day ( First date of employment ) ; Day ( First date of employment ) ; Day ( Get ( CurrentDate ) - Day ( Get ( CurrentDate ) ) ) ) ) ) & " Days " I also have a field for the date an employee ends their employment. I have tried several approaches but cannot get a solution working that will take into account the end date and halt this calculation where an "end date" has been entered. Any ideas are gratefully received. Best regards, Tim
April 1, 20169 yr Did you leave something off,like a Case Statement, or Let Statement? There are several Elapse and Age Custom Functions at Brian Dunning’s site here http://www.briandunning.com/filemaker-custom-functions/recentlist.php Elapse days is not exact. 39 minutes ago, topazmedia said: I also have a field for the date an employee ends their employment. What do you want this to show? Elapse days from hire to end of employment? There is also one here https://community.filemaker.com/thread/147929 that the poster claims accounts for February?
April 1, 20169 yr Author Thank you for the reponse and link Lee. I'll check it out. The field for the end date of employment is for entering their last actual day of employment. Upon entering a date into this field I want the employment age field to halt based on that date. Best regards, Tim
April 1, 20169 yr Your question seems to be the same thing. The first one seems to be asking for a calculate to just know how long they employee has been with the company? i.e. such as anniversaries? The second one seems to be just calculation how many days, months and years they work for the company?
April 2, 20169 yr On 04/01/2016 at 7:09 AM, topazmedia said: a solution working that will take into account the end date and halt this calculation where an "end date" has been entered. Start your calculation with: Let ( [ end = If ( EndDate ; EndDate ; Get ( CurrentDate ) ; then use the end variable instead of Get (CurrentDate) in your formula. Note: I have not gone over your formula. If you check previous posts on the subject, you will see I have repeatedly advised against calculations that try to express a duration in years, months and days.
Create an account or sign in to comment