5 Replies Latest reply on Aug 6, 2013 7:15 AM by philmodjunk

    Staff log in

    AustinEckman

      Title

      Staff log in

      Post

           Im writing code right now for when they press a butt on sign them in and it will track them on a database. My problems right now that I dont know how to fix are people can spam new rows with the sign in button, I am trying to have it so that they can sign in only once without logging out atleast once. I cant have it go by time because then people who work night would have issues. Thanks any help is appreciated 

      clock.png

        • 1. Re: Staff log in
          AustinEckman

               I fixed the issue of having too many end ifs in the top one

          • 2. Re: Staff log in
            philmodjunk

                 You actually have multiple issues in those scripts beyond the extra End IF in your posted example.

                 Your clock out script does not attempt to find the correct record for the current employee before clocking them out. Thus it could modify the record for "John's" time card when "Jim" clocks out and vice versa.

                 When logging in, you'll need to use either a relationship or a scripted find to access the employee's most recent timecard. Then check to see if that timecard record shows that the timeStampOut field is not empty. If it is empty, the employee did not log out the previous time.

                 And when logging out, the system should use the same method to access the employee's most recent timecard record and make sure that the TimeStampOut field is empty. If it is not empty, the employee failed to log in like they should.

                 And even this will not catch all possible errors as an employee could clock in on day 1 and fail to clock out, then fail to clock in on day 2, but then clocks out successfully--which then logs the employee as working continuously from the clock in time from day 1 to the clock out time for day 2. Thus, you should also have your script check for intervals between the time/date clocked in and the time/date clocked out that exceed a value beyond a certain ceiling--probably something like  20 hours (in seconds) to catch that specific error.

                 If you have this relationship:

                 Employees::EmployeeIDpk = TimeCards::EmployeeIDfk

                 You can sort the TimeCards Records in descending order by TimeStampIn in the relationship linking these two tables and then a reference to timecards from the Employees layout will automatically refer to the employee's most recent time card record.

            • 3. Re: Staff log in
              AustinEckman

                   Thanks for the tips, I've got a better idea on what to do now

              • 4. Re: Staff log in
                AustinEckman

                     Also these records will be checked every day by a floor manager so if someone did forget to punch in or out it would be figured out pretty quickly

                • 5. Re: Staff log in
                  philmodjunk

                       And you can do a find for records where a field is empty by using a lone = sign in that field as your find criterion.