Need Help for Infopath form functions to subtract time - InfoPath Dev
in

InfoPath Dev

Need Help for Infopath form functions to subtract time

Last post 10-15-2014 11:04 AM by Upender Singh. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 10-14-2014 09:36 AM

    Need Help for Infopath form functions to subtract time

    Hello Hilary,

    First of all I would like to thank you for your posts.

    I have gone through it and already resolved most of my concern.

    Currently I am working on a Infopath form which I love to attach it however not getting an option to add it.

    I am working on a form which is connected to Access database in backgroud to submit the data.

    I added a break start time and end time but not able to get a total break time or total time.

    Please help me to get the total break time and balance break time.

    You can see there is  field with total shift hours so we can get this as well.

    I have searched the net but not able to understand it.

    Please do let me know if i need to amend the form in order to get the desired results.

    Thanks for your support in advance.

     Regards,

    Upender Singh 

     

     

     

     

     

     

    Regards,

    Upender Singh
  • 10-14-2014 09:51 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Try this post and see if it helps:

    http://www.braintrove.com/id/95

    Hilary Stoupa

  • 10-15-2014 08:16 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Hello Hilary,

    Thank you for your prompt response.

    I have tried the function given on  

    http://www.braintrove.com/id/95

    and below is the formula i created as given.

    translate(addSeconds(@Coaching_Out_Time, -1 * (substring(@Coaching_In_Time, 1, 2) * 3600 + substring(@Coaching_In_Time, 4, 2) * 60 + substring(@Coaching_In_Time, 7, 2))), "ER?", "") 

    Below function is given on webpage:

    translate(xdDate:AddSeconds(../my:EndTime, -1 * (substring(../my:StartTime, 1, 2) * 3600 + substring(../my:StartTime, 4, 2) * 60 + substring(../my:StartTime, 7, 2))), "ER?", "")

    I typed the formula and once I clciked to check formula the (xdDate) gets vanished and no data is updated on total time feild.

    All my fields are time format to 09:46:15 hence I tried other format as well but no use.

    I tried to add the form image today as well but no get through.

    Please help.

    Regards,

    Upender Singh

     

    Regards,

    Upender Singh
  • 10-15-2014 08:22 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Can you attach a copy of your form under the Options tab in a reply? I'll take a look at your formula.

    Hilary Stoupa

  • 10-15-2014 08:45 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Hello Hilary,

     Thank you for your prompt response.

    In the meantime I have tried two other function but getting NaN on one and on another it shows false.

    both formula on below page.

    http://www.formsonfire.com/infopath/calculating-time-differences-in-infopath-without-custom-code/ 

    Thank you for letting me know as how we can attach the form.

    I have also tried to query the details from access database as done a calculation steps but no use as it quering data once form submitted to database.

    Thank you.

    Regards,

    Upender Singh 

     

    Regards,

    Upender Singh
  • 10-15-2014 09:01 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    This one is close - save the file locally and then right click and select Design to open in design mode so you can look at the default value for the time spent coaching.

    I used the formula from the BrainTrove post - the thing is, in that formula you have to have Time fields and your fields are all date / time. So, I added an additional substring-after to the fields to only get the data after the "T" in the date time. However, that gave me a validation error since your field for the time spent is also a date time, and I was populating it with time only. So, I added a concat to include the date - and also a "T", so the XML would be valid. The issue there is that when there is no start or end time, the default is "T", which is an invalid date time. So - you may want to use this formula or something similar in a rule on your start and end time to set the value of the total time instead of using a default - then you have more control over when the rule runs (only when there is both a start and an end time, for example). At any rate, hopefully this will give you some ideas and something you can work from.

    Hilary Stoupa

  • 10-15-2014 09:17 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Hello Hilary,

    That's wonderfull, you made my day.

    I have checked the file and understand the validation part.

    I added the same function on other fields and giving me the desired result but yes as you confirmed it will give a validation of T if start and end time is blank.

    I do not have knowledge about it but what I have learnt on infopath is from web and lots of functions from your post so that is the reason I tried to contact you at first instance to get help and I appreciate it.

    I have also searched on website and found as they advise to pick Time feild only instead of date and time but I do not get time feild option on infopath. Is it related to access database which it is connected to?

    Anyhow my query is resolved and will contact you if I need any further help.

    Thanks for your support.

    Regards,

    Upender Singh 

     

    Regards,

    Upender Singh
  • 10-15-2014 09:21 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Your form is bound to your Access database - I don't know if Access has time only column types. :)

    If you started your form as a new, blank template (not bound to a DB) you can have time data types. Of course, then you wouldn't be able to out of the box submit to Access, so that probably means that won't work for you.

    Glad this helped.

    Hilary Stoupa

  • 10-15-2014 09:28 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Hello Hilary,

    One more thing I would like to know.

    Yes as you have got it correct. I first created the database and while creating the form directly connected it and design the form.

    Earlier I tried to create a blank form and then connect it to database but it not allowing me dont know the exact cause but i think might be because of one field which require more than 255 character.

    As you have seen the form there is a field Login Date and Time and at the end of the form one field with Total Shift hours.

    Is there is any function which will start timer or clock on total shift time once login Date and time entered.

    Thank you for your support.

    Regards,

    Upender Singh

    Regards,

    Upender Singh
  • 10-15-2014 09:36 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    You'd probably have to write code for that.

    Hilary Stoupa

  • 10-15-2014 09:41 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Hello Hilary,

    Thank you for your support provided to get the query resolved.

    Regards,

    Upender Singh 

     

    Regards,

    Upender Singh
  • 10-15-2014 11:04 AM In reply to

    Re: Need Help for Infopath form functions to subtract time

    Hello Hilary,

    As you have advsied we need to write a code to get the total shift hours hence I have added a current time feild on form which will reflect once shift status is selected.

    Once shift status selected it will reflect the current time on current time feild and total shift hour feild will get it value from current time - logged out date and time and it is fruitfull.

    I have tried to get total of 01st break total + 02nd Break total + 03rd Break total however no sucess.

    Could you please explain how to sum up the total break function.

    Thank you.

    Regards,

    Upender Singh

    Regards,

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