topazmedia Posted April 1, 2016 Posted April 1, 2016 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
Lee Smith Posted April 1, 2016 Posted April 1, 2016 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?
topazmedia Posted April 1, 2016 Author Posted April 1, 2016 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
Lee Smith Posted April 1, 2016 Posted April 1, 2016 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?
comment Posted April 2, 2016 Posted April 2, 2016 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.
Recommended Posts
This topic is 3226 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