Jump to content
Server Maintenance This Week. ×

Script button status changes


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

Recommended Posts

I would like to create a button for employees to hit so it generates "COMPLETE" when they have completed the data entry for thier timesheet line items. Often they have more than 8 hours to enter, but don't always get it entered every day. The script for the button is set so that if thier total time worked is less than 8 hours, it will give them a message telling them they can't proceed, else it marks the field "COMPLETE".

However, if they then go back and change a line item which would reduce the total time worked to less than 8 hours, the "COMPLETE" note still remains and thus is invalid.

I need a way to make sure when hours drop below 8 the "COMPLETE" note will disappear. If I use a calculation field for the "COMPLETE" then the employee doesn't have control over indicating if thier timesheet is done.

Any ideas out there?

Thanks

Jana smile.gif

Link to comment
Share on other sites

I use a process button to check the hours, and submit and approve a time log. The scripts are fairly complex to deal with all the possibilities, but the idea is:

If [ Total Hours > 8 ]

Set Field [ Status, "Submitted" ]

Else

Set Field [ Status, "In Progress" ]

Show Message [ "Not enough hours" ]

...

End If

Link to comment
Share on other sites

Thanks Ender, for the breakdown on the script. Although my problem with the hours going below 8 after the button has already generated submitted still remains.? I know it might seem strange but , but I don't want to pull a monitoring report of all submitted timesheets with the chance that someone changed thier record after submitted occurred and it doesn't have 8 or more hours. This could happen unintentionally, and sometimes, intentionally.

Any suggestions?

Link to comment
Share on other sites

If they have to click the button after each change, then Ender's steps should work. If they can move on without clicking it, then you may need a trigger that tests the results after each entry or change and updates the field, even if they don't click the button.

You will need a time field with an auto-enter of modification time and a calculation text field of Left( modtime, 0 ) & serial. Create a self-relationship between this field and the serial id field, assuming you already have one. Create another calculation text field equal to Case( not IsEmpty(Status) and Sum(employee_date::hours) < 8, "", Status ). Then on your Status field definition, set it to Lookup this new calculation field based on the self-relationship recently created. Any time a record is changed, the field should be cleared if necessary. Otherwise, it will overwrite itself with the same data and not appear to change.

I wrote all this from memory, so feel free to correct me if I botched something. wink.gif

Link to comment
Share on other sites

Thanks Queue, I attempted this scenario but it is not functioning properly. Can you clarify that I interpreted you correctly.

"Create a self-join between this field and the Serial ID field"; did you mean by "this field" the "calculation text field of Left(modtime, 0 & Serial ID" field? Thus it would be a relationship with the field from "caluculation text field of left(modtime,0 & Serial ID" on the left side of the relationship and Serial ID on the right side of the relationship???

AND

"Status field definition, set it to Lookup this new calculation field", meaning "this new calculation field" as the "text field equal to Case(not sEmpty(Status (employee_date::hours<8, "", Status),:)

Did I follow you right?

Thanks

Jana smile.gif

Link to comment
Share on other sites

Jana, yes and yes.

Is it functioning for new records? I didn't clarify that existing ones will have to be modified first, before any change will occur. Note that employee_date would be a self-relationship based on an employee id and date of service calc such as EmpNo & "_" & dateService.

What exactly are the results you're receiving?

Link to comment
Share on other sites

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