Alpha Video Training
Page 1 of 2 12 LastLast
Results 1 to 30 of 51

Thread: Checking Existing Time/Date

  1. #1
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,170

    Default Checking Existing Time/Date

    I have a user who I have already created a table and input browse where he enters employee name, then the date they started work, then the time, then the date they stopped and the time. Based on this A5 does the calculations of total time.

    But he recently showed me where he had so many time slips coming in, that at times, one might be doubled. Or perhaps, an employee might submit an old timeslip with different times worked. What he wants is a way to check this input and if it looks like a duplicate, pop-up a message advising him and then allowing him to force the entry through if he chooses to do so. The complexity is the time hours worked.

    Let's say that EmployeeA submits a timeslip for X date saying he worked from 06:00 to 15:00. Later he submits a timeslip saying he worked from 09:00 to 19:00 on the same day. How would I find this?

    I tried to do this by using the OnChange event in the input browse, but where I got hung-up was when I am entering values and at the same time checking them against the same table. I attempted to solve this issue by using a function and sending the values to that, but it's still not working.

    Thanks for any ideas.

  2. #2
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    well ..... most likely an employe has a unique identifying number, like employee_num. this makes it easy to determine if the employess already has a record for that day, using either dbcount() or tablecount().

    Now the employee may be working at different locations, like job 1 and job 2, which is a bit more complicated

    But if he is only working at one location, and there are two timeslips, as described, with apparently fradulent or at best conflicting entries, I would then reject both entries, and point out the discrepency to the employee, and require same to resubmit a single time slip.

    With the entries you described, if you accept only one, the employess is robbed of time; if you accept both the company is robbed.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  3. #3
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Checking Existing Time/Date

    Charles I set up a table of bookings from A..to B dates. With most problems the solution occurs as simple until you try. This was not too difficult.
    Created a filter algorithm line to check for any date conflict, and filter the existing booking/s on where there is conflict with any proposed period for the person.
    My example is a demonstration of the principle for date/time. If this is what you are after.
    Using a browse in IW
    Code:
    tb=table.current()
    per="KIOPL.CO"
    s1="20/08/2013"
    s2="21/08/2013"
    filt="cust="+quote(per)+" .and. ((adate<={"+s1+"} .and. bdate>={"+s1+"}) .or.  (adate<={"+s2+"} .and. bdate>={"+s2+"}))"
    reslt=tb.query_create("",filt)
    if reslt.records_get() >0 ' there is a conflicting existing record
         DefaultBrowse_booking.Resynch()
    end if
    The table fields are naturally Cust, Adate and Bdate

  4. #4
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Checking Existing Time/Date

    Is it possible someone went to work, left for some reason, and came back the same day?
    Is it possible that someone worked > 1 shift?
    What are the typical work hours? 9-5? or around the clock?

  5. #5
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    It is not reasonable that he worked from 06.00 to 15.00 AND 9.00 through 17.00
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  6. #6
    "Certified" Alphaholic Charles Hoens's Avatar
    Real Name
    Charles Hoens
    Join Date
    Sep 2000
    Location
    Princeton, NJ
    Posts
    1,170

    Default Re: Checking Existing Time/Date

    Thanks for the suggestions and ideas. I guess what I am looking for is how to lookup something which is being input within the table you are inputting to. I was thinking something along the lines of using the exist function within the field rules along with the between function.

    As for how this could happen, I thought at first that it was kind of impossible along the lines of what Martin was saying. However, in this company, they have hundreds of employees scattered around the State of NJ, and some people, quite frankly forget that they already sent in a timesheet for certain times. I've even seen ones where the employee changes the original times that they were already paid for. That's why they asked me to come up with some kind of solution, so that when the employees fax in their timesheets, the person doing the input would be helped in finding a possible duplicate entry.

    It's just one of those cases where, just when you thought you saw everything, something else pops up to test your abilities. My fallback position is to flag anything that has the same date during input.

    I'd be interested in any other ideas or approaches.

    Thanks!

  7. #7
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Checking Existing Time/Date

    I understand it is unreasonable to work these hours, but that was just one example. My questions were general ones to determine the simplest approach.
    If the work hours are day-time only, not around the clock, and
    If there is only one shift per day, and
    If an employee does not leave and return
    Then:
    The simplest approach is to match the employee with the date. Since only one shift could be worked per day, no need to bother with matching overlapping times.
    If otherwise, then you treat it like a calender to check for overlapping time and date.
    My questions were simple and general and yet to be answered.

  8. #8
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,365

    Default Re: Checking Existing Time/Date

    Simplest is the Validation rule that EmployeeID and Date must Not Exist in a Table. Unless they work overnight as G has questioned and try to put it on one timesheet.
    This will force the input person to suspend processing. You might want to add a field showing acceptance or in dispute somewhere to list all disputed items.
    If the Validation fails, the inputter can find and change the original if approprite.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  9. #9
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Checking Existing Time/Date

    I know this is desktop side.
    I have implemented this on my web where the sign in is by the employees. when they select a date and their name, as ted says, I look into the table and display what times they already signed in for and if not I say "you are not signed in". then they can proceed to sign in. reading the first post it appears that the time slips are given by the employees and the employer enters the data directly into a browse. in my approach the time slips are entered and added to the employee work table by the employees, since they already know what times they are signed in, this will prevent repeat entry. and you can add a comment field to add any comments by them why certain slips are different or duplicated.
    then before the payroll on Monday I review a print out of the time grouped by employees and date. if there is any discrepancy I contact the employee and delete the appropriate record.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  10. #10
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Checking Existing Time/Date

    Quote Originally Posted by Charles Hoens View Post
    Thanks for the suggestions and ideas. I guess what I am looking for is how to lookup something which is being input within the table you are inputting to. I was thinking something along the lines of using the exist function within the field rules along with the between function.

    I'd be interested in any other ideas or approaches.

    Thanks!
    Charles hello!
    That is precisely what that code in post 3 will do.
    When validating the input time range that code can open a second instance of the table you are using to look up - simply substitute tb=table.current() with table.open(...
    reslt.records_get() >0 ' tells you immediately that there is and number of conflicting existing overlappaing record/s for that employee for that time range.
    I find it soooo strange that you appear to choose to absolutely ignore a fully prepared solution then ask again for any other ideas.
    Just ask if you want explicit alteration for your particular example - I've tested it, live, it works as you describe.
    Last edited by Ray in Capetown; 04-19-2014 at 09:44 AM.

  11. #11
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Checking Existing Time/Date

    I tested the same method I use in web on the desktop side using a form (not browse) for entry and it works just fine using onChange event of one of the fields ( second to enter of the two).
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  12. #12
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    It would be fairly simple - it would require a script at the cansave record event in the embedded browse
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  13. #13
    Member
    Real Name
    John Michaels
    Join Date
    May 2013
    Posts
    54

    Default Re: Checking Existing Time/Date

    For goodness sakes.
    Make the time entry into an xdialog.
    Then have the checks of the data from the xdialog done against the table before anything gets saved and present whatever message needs to appear.
    John Michaels
    "The only thing needed for evil to flourish is for good men to do nothing" - great quote but probably not Sir Edmund Burke

  14. #14
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,365

    Default Re: Checking Existing Time/Date

    For goodness sakes.
    Make the time entry into an xdialog.
    Then have the checks of the data from the xdialog done against the table before anything gets saved and present whatever message needs to appear.
    Show us how you would do that please John. Others will be interested.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  15. #15
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Checking Existing Time/Date

    Glad you mentioned show others Ted.
    It appears that Charles is not really interested in suggestions nor of the help given or... ??
    I have now used the snippet I devised (#3) in my own scheduling application so I'm ok Jack.

  16. #16
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,365

    Default Re: Checking Existing Time/Date

    I think Charlie is OK, Ray. Probably topping up his sun tan in the Caribbean.
    He usually replies.
    I hope John posts an example, as I'm keen on seeing what his Xdialog (Ugh!!) looks like.
    How's the new job?
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  17. #17
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Checking Existing Time/Date

    Right on schedule with that so far Ted.

  18. #18
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Checking Existing Time/Date

    Quote Originally Posted by Ted Giles View Post
    Show us how you would do that please John. Others will be interested.
    Ted,
    You know I love xdialog, so I'll take this one on (see attached ).
    Attached Files Attached Files
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  19. #19
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Checking Existing Time/Date

    Wrote one years ago on a simple form. Memory - help! I think version 5?
    drop down on form to choose name/id ( they had to supply password)
    if they were not clocked in, they could(their name/id was marked as in with a T/F field)
    if they were clocked in, they could only clock out.
    each time they logged in the field was marked T/F
    Never a duplicate

    I would never use a browse for this!

    EDIT: Just remembered, we later changed it so they had to input their id and password, (eliminated the drop down). They then saw their name and status(in or out) so they could proceed.
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

  20. #20
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    I think we are missing the point for Charles, he doesn't need a special GUI for entering the time, he needs a way to check for existing entries, and a way for the user to deal with it when there are conflicts. He needs a custom script. In the cansave record event in the embedded browse, if one already exists, I would cancel the second entry and possibly bring up a small form as a dialog and point out the discrepancies and let the user change or not change the original.

    Ted, you need to make the date and time fields in your example conform to standard entry, where they don't have to enter slashes for dates, and can just enter 3.0A or 4.25p for times. Thats why a small form opened as a dialog, where there are dates and times is always better than an xdialog, and quicker and easier to make!!
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  21. #21
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    Dave,
    Charles is entering from a fax - the user is not entering. Someone with accounting privileges is entering a bunch of time slips from a bunch of faxes.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  22. #22
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,026

    Default Re: Checking Existing Time/Date

    If using a form with identifier for employee, and the inputs. also an imbedded browse where the browse would show the last(by date) records for the employee. It would show up rather quickly. You would need a browse large enough to show about 10 days of inputs.

    Make sense. Like I said before, I rarely use a browse for input.
    Dave Mason
    dave@aldausa.com
    Skype is dave.mason46

  23. #23
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Checking Existing Time/Date

    The only example in this thread is from MikeW.
    You dont need to enter MANUALLY in the browse in that particular format. Press the button and a great Xdialog takes over.
    The browse is there for reference only I believe.

    Mike, how the heck do you remember all the syntax, let alone the sequencing - whats the trick? or is it all tediously hand coded?

  24. #24
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    Alpha Demo.zip

    Here is a sample app that does what Charles wanted - note the emphasis on "what Charles wanted"

    the whol;e thing took an hour to put together - albeit it is quite simple.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  25. #25
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    There was a hitch in the giddy-up of the first one, but here is one that will work as advertized
    Attached Files Attached Files
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  26. #26
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Checking Existing Time/Date

    Quote Originally Posted by Ray in Capetown View Post
    The only example in this thread is from MikeW.
    You dont need to enter MANUALLY in the browse in that particular format. Press the button and a great Xdialog takes over.
    The browse is there for reference only I believe.

    Mike, how the heck do you remember all the syntax, let alone the sequencing - whats the trick? or is it all tediously hand coded?
    Ray,
    I learned it over time and built a nice library of templates. Then I draw from the templates and massage it to get to what I need. I like xdialog so much because it is unbound, and I can build an run them much of the time directly from the code editor without having to be in a form. And the conflicts that occur with record locking/conflicts for multi-user environments is reduced. The syntax is learned over time, and just like anything, the more you use them the more you learn to use them.

    Martin, nice example. When he wrote"
    Let's say that EmployeeA submits a timeslip for X date saying he worked from 06:00 to 15:00. Later he submits a timeslip saying he worked from 09:00 to 19:00 on the same day. How would I find this?
    I didn't take this to mean he wanted to navigate
    Last edited by Mike Wilson; 04-25-2014 at 05:39 PM.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  27. #27
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Checking Existing Time/Date

    Mike,
    I chalenge you - use my program, but with an xdialog screen, and match the speed, simplicty, and functionality that mine offers, especialy as regards what Charles originally asked for, compared to yours, and record about how much time it took.
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  28. #28
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,644

    Default Re: Checking Existing Time/Date

    Martin,

    I almost like your example but what if Henry Ford works on ABC inc. from 6am to 1pm and then works on Alpha Custom Programming from 2pm to 4pm? Or works on one project all day except when he goes to lunch from 12pm to 1pm?

  29. #29
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,644

    Default Re: Checking Existing Time/Date

    Ray,

    And I thought I was old school.

    tb?
    per?
    filt?
    reslt?

    I used to work with a FoxPro guy who didn't like to "waste" characters either. Never knew what he was trying to tell me.

  30. #30
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Checking Existing Time/Date

    I don't believe that Charles had worked out how to do the initial test, ie identifying it, handling an overlap was secondary. To me the title of the post is evidence of that.
    But wow, some nice examples came out of this.
    As far as Xdialogs, im seriously challenged, I often create imitation ones to get around that. But I still keep trying. Nothing like the real thing.

    Now just saw Peter's post.
    If a married Jewish man is walking alone in the desert and has an opinion ? Is he still wrong?
    Last edited by Ray in Capetown; 04-25-2014 at 07:00 PM.

Similar Threads

  1. TIME Field - Date picker still giving DATE and TIME
    By pettechservices in forum Application Server Version 11 - Web/Browser Applications
    Replies: 8
    Last Post: 05-04-2012, 07:18 AM
  2. new date and date time pickers in v11
    By Richard Rabins in forum Announcements
    Replies: 0
    Last Post: 08-12-2011, 07:16 PM
  3. How to get Time from ODBC Date/Time field
    By cpgood in forum Alpha Five Version 9 - Desktop Applications
    Replies: 2
    Last Post: 06-06-2010, 12:24 PM
  4. Date Picker not displaying time, only date
    By ChristJC in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 09-07-2009, 11:12 PM
  5. Replies: 0
    Last Post: 06-22-2006, 05:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •