Jump to content

Stop field calculation


Totes

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

Recommended Posts

I currently have 3 fields relating to an employees employment date:

The first field is the date of hire

The second field is a calculation of years from the first field.

The third field shows an employees exit date.

My question is this: is it possible to have the second field (calculation of years worked) stop calculating the years if a date is entered into the third field (date of exit)

I know I could get a calculation from field one and three after the employee leaves however I do not want a calculation of that nature, I need to be able to look at the field and get a “live” display of the worked years.

Or does anyone know of a better way showing these three fields of data.

Thanks,

James

Edited by Guest
Link to comment
Share on other sites

Wrap your calculation as follows:

Case ( not ExitDate ;

yourcalchere

)

UPDATE: I'm unsure what you mean by 'live display.' The above will blank the field if the Employee terminates. If instead, you want the years to quit calculating and 'freeze' when terminated, we'd need to see your age calc. Although you phrased your post quite nicely, I'm still unclear on the result required.

Edited by Guest
Added Update
Link to comment
Share on other sites

LaRetta,

Thanks,

I did as instructed, I assumed it workded???

when the date of exit was entered the second field showing the years worked then showed empty.

Is there a way to keep the last number in the second field visible?

Thanks again,

James

Link to comment
Share on other sites

I jsut saw your update...here is the calc including your wrap. this is the first field (Date_Of_Hire) and shows in the second field (Years_of_Service)

You are correct...I do wish for the second field to remain visible, and to stop calculating.

Case ( not Date_Of Exit ; Year(Get(CurrentDate)) - Year(Date_Of_Hire) -If(GetAsNumber(Get(CurrentDate)) < GetAsNumber(Date(Month(Date_Of_Hire); Day(Date_Of_Hire); Year(Get(CurrentDate)))); 1; 0))

Edited by Guest
Link to comment
Share on other sites

I had posted then deleted it. I discovered an inconsistency when using a variable with a blank date. Anyway, that's another issue. Calculation should be number and unstored (in Storage Options):)

Let (

endDate = Case ( ExitDate ; ExitDate ; Get ( CurrentDate ) ) ;

Year ( endDate ) - Year ( Date_Of_Hire ) - ( endDate < Date ( Month ( Date_Of_Hire ) ; Day ( Date_Of_Hire ) ; Year ( endDate ) )

)

)

Link to comment
Share on other sites

LaRetta,

I tried your calc: and it gave me a number resulting from the Date of Hire and the Date of Exit.

What I am attempting to do is:

THE EMPLOYEE IS STILL WORKING:

A calculation showing in the second field (Years_Of_Servcice) so that a user can bring up that employee and see at a glance that they have been there x-number of years…this is what I am calling a “Live” number…it is still calculating because the employee is still working. so you are seeing fields showing: Hire Date / Years Worked / (Exit Date is empty)

THE EMPLOYEE LEAVES:

Now, when the employee leaves, the (Date_Of_Exit) field is entered, when this date is entered…it stops the calculation and still shows a number in the second field (Years_Of_Service) which remains visible….however all calculation have ceased…so you are seeing fields showing: Hire Date / Years Worked / Exit Date.

This is so the user can bring up the employee at any point during active employment or after an employee exits and show that they worked x-number of years.

I’m thinking I may have to generate another field?

Give me a minute and Ill post a pic of the fields.

Thanks for your help.

James

Edited by Guest
Link to comment
Share on other sites

I don't know what to tell you. Why does the Employee have a Date_Of_Exit when they are still Active? It should be blank. If you wish to display the current date in place of Date_Of_Exit, if the Employee isn't terminated, you can do so; but it can't be an auto-enter (replace) because it won't refresh.

Simply, seeing a Date_Of_Exit date on an Active employee makes no sense to me. Did you make sure the calculation is UNSTORED?

Link to comment
Share on other sites

Sorry about that screenshot...your are correct it is blank, I was working on the layout when I took the shot.

The correct shot would show the status field reflecting that the employee was gone for whatever reason. When the status field shows anything but active they are sorted not to show (only active employees, who would only be showing a hire date and years of service at that point would be shown)

I have put in place your last calc, everything seems to be working as needed with that one.

Thank you so much for the help, I dont think I could have figured that one out on my own...hope I can return the favor one day.

James

Edited by Guest
Link to comment
Share on other sites

This topic is 6317 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.