Time - Recording Hours and Minutes & best practice - InfoPath Dev
in

InfoPath Dev

Time - Recording Hours and Minutes & best practice

Last post 11-11-2011 01:48 PM by leoffneym. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-11-2011 09:52 AM

    Time - Recording Hours and Minutes & best practice

    Grrrr I am really pulling my hair out with this one  - cant work out the best way to do it!

    I am creating an Overtime submission form for staff to submit hours worked overtime.  There is a field which allows the user to put in how many hours and minutes they have worked over for a particular month.  I was going to use a time field but then realised i am limited to 24 hours, we may have some people that do say 36hrs 30mins overtime in a month so they would enter 36:30.  What Data type would you use for this?  and how would you validate / restrict it?

    I am also then going to put the figure into a SQL database for reporting purposes - ie to calculate amount of over time over a certain period ie 3 month.  

    I am struggling with the concept and I would be grateful for some help on this one

     Thank you 

     

     

     

  • 11-11-2011 12:28 PM In reply to

    Re: Time - Recording Hours and Minutes & best practice

    How about providing separate fields for hours and minutes, and then a calculated read-only or hidden field for the hours + fractional hours (hours + minutes div 60)?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-11-2011 01:48 PM In reply to

    Re: Time - Recording Hours and Minutes & best practice

    For simplicity sake, I would do as Jimmy suggest and use two fields, with the hidden calculated field.
    The fields themselves could be regular text or numerals, since you will have to validate them if they change anyways.

    EX:

    2 Fields: HoursTB, MinutesTB
    Both are default set to 0
    Both have at least this data validation: This Field (HoursTB or MinutesTB) is not equal to 0 AND This Field (HoursTB or MinutesTB) does not match pattern Custom Pattern: 0 (See below)
    How to get the pattern:

    1. From the drop down, select Custom Pattern
    2. In the Custom pattern field, clear the field
    3. Type in the Custom pattern field: \d+
    4. Hit the OK button

    Add your screen tip to say something along the lines of "This field can only be a number"

    What does this one data validation do?
    It makes sure of two things: First, your field will always be a number and Second, it will always be a number.

    From here you can do like Jimmy suggested and convert this into a decimal hour to figure out what you need.

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.