Jump to content

IF command in calculating fields


This topic is 6518 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Good Afternoon:

I have a perplexing calculation that I would like help with, if possible.

I am working on a large Human Resources Database using FM 7 Pro. I am trying to calculate years of service for an employee. I have the field calculating current date - hire date divided by 365 which returns the value fine. What if the employee leaves? I have a field for termination as a yes/no value list and then a field for termination date. I need my database to stop calculating years of service if the terminated field is set to yes. I have tried "IF" statements calculating current-hire date/365 if the value of the terminated field is "no" and another statement current date-termination date/365 if the value in terminated is "yes". It does not work. I also tried a case statement but cannot seem to get that to work either. Can anyone assist me? Many thanks in advance.

Link to comment
Share on other sites

You can omit your current date field. You want an unstored (calculation, type is date) with:

If ( termDate ; Year ( termDate ) ; Year ( Get ( CurrentDate ) ) ) - Year ( hireDate )

... that should do it for you. You didn't indicate whether months were taken into account or days - and whether you wish to round up or down. This calc is VERY generic. We can adjust as needed because if someone works 10 months, what do you consider their years of service? We need rules here.

Link to comment
Share on other sites

We can provide a more accurate calculation including months of service. This calc assumes they don't get one year credit until they have been there a full year. It all depends upon your requirements. But it sounds like you've got it now. :wink2:

Link to comment
Share on other sites

This topic is 6518 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.