Start & Finish times & Calculate Total - InfoPath Dev
in

InfoPath Dev

Start & Finish times & Calculate Total

Last post 07-02-2013 03:35 AM by ArtySin. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-29-2013 03:10 AM

    Start & Finish times & Calculate Total

    Hi, I have just created my first InfoPath form which is a timesheet form for which I have three fields: txtStart_Time txtFinish_Time txtTotal_Hours All three fields are set to a data type of time (09:46). The txtTotal_Hours has had its' default value set to a formula of txtFinish_Time - txtStart_Time and the formula checker says it's OK. When the preview button is clicked the txtTotal_Hours field displays "0" as it should but then the problem arises. Entering a start time of 09:00 and a finish time of 17:00 just display NaN. It works OK with the three fields set to decimal but a time format is required. I've searched on here and the web but have found no answer to what must surely be a simple thing. So any help is much appreciated. Many thanks ArtySin
  • 06-29-2013 04:28 PM In reply to

    Re: Start & Finish times & Calculate Total

     Unfortunately, there is no easy way to do this in InfoPath. There is no built in functionality for date or time differences. Options are custom code, qRules, or you can find some blog posts with rather complex formulas like this one - http://www.formsonfire.com/infopath/calculating-time-differences-in-infopath-without-custom-code/. If you are using IP 2010 and you happen to have SharePoint 2010 with Excel Services, I think a person could also accomplish this using Excel + REST. I'm sorry - this is not what you want to hear, I know - but it is just one of those gaps in InfoPath functionality.

    Hilary Stoupa

  • 07-02-2013 03:35 AM In reply to

    Re: Start & Finish times & Calculate Total

    Hilary, thanks for that so I put my thinking cap on, and decided that the times displayed would only be for e.g: 09:00 09:15 09:30 09:45. The values would then be 9.0 9.25 9.5 9.75 and similarly for this finish times. Total hours worked is then a simple subtraction of the start time from the finish time and all works perfectly. :-)
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.