AnsweredAssumed Answered

Employee Time Clock Script Not Functioning Correctly

Question asked by simmka on Aug 14, 2014
Latest reply on Aug 14, 2014 by simmka

Title

Employee Time Clock Script Not Functioning Correctly

Post

     I've tried many variations on this script. This is the furthest I've gotten with it so far that it's been able to pull the data that I need. What I need it to do is:

     When an employee is wanting to clock in or out for the day, they will click a button on the home page layout that will run the below script and take them to a seperate layout (Called "Shift Time") where their day's shift record is either created or edited, depending on if the script finds a record with the employee's account name and the current date (if it finds a record already for that employee on that date it should go to the record and allow editing, if not it should create a new record for that employee on that date).

     The problem I am running into with the below script is that while it does find the correct date information, it's not finding the correct employee information, it's pulling ALL employees for that date. I need it to only pull the employee record that is logged in for the current date.

     Here is the script I'm using:

     Set Error Capture [On]

     New Window [Name: "Shift Time Log"; Style: Dialog]

     Go to Layout ["Shift Time"]
     Perform Find [Restore]
     (the find here is Day Time::Employee Clocked [get(accountname)] AND Day Time::Shift Date [//])
     If [Get ( FoundCount )   >   0]
     Go to Record/Request/Page [First]
     Exit Script []
     Else If [Get ( FoundCount )  = 0]
     Enter Browse Mode []
     New Record/Request
     Set Field [Day Time::Shift Date[]; Get (CurrentDate)]
     Set Field [Day Time::Employee Clocked[]; Get(AccountName)]
     End If
      
     Thanks!

Outcomes