Adding 2 time fields together - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Adding 2 time fields together

Last post 05-22-2016 03:45 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-20-2016 11:15 AM

    Adding 2 time fields together

    I am trying to add 2 time fields together to get a total time. Here are the 2 fields default values that I am adding together. The formula verifies but when I preview the form the field displays NaN. concat(substring(100 + number(concat("0", substring(EndTime, 1, 2))) - number(concat("0", substring(EndTime, 1, 2))), 2, 2), ":", substring(100 + number(concat("0", substring(EndTime, 4, 2))) - number(concat("0", substring(StartTime, 4, 2))), 2, 2), ":", substring(100 + number(concat("0", substring(EndTime, 7, 2))) - number(concat("0", substring(StartTime, 7, 2))), 2, 2)) + concat(substring(100 + number(concat("0", substring(FromEnd, 1, 2))) - number(concat("0", substring(FromStart, 1, 2))), 2, 2), ":", substring(100 + number(concat("0", substring(FromEnd, 4, 2))) - number(concat("0", substring(FromStart, 4, 2))), 2, 2), ":", substring(100 + number(concat("0", substring(FromEnd, 7, 2))) - number(concat("0", substring(FromStart, 7, 2))), 2, 2)) The 2 fields I am trying to add together are text box with Time data types, the field that I am trying to display the above formula in is text box with data type Text(string). Not sure how to fix it.
  • 05-22-2016 03:45 PM In reply to

    Re: Adding 2 time fields together

    I recommend adding a rule to strip out the formatting from the text boxes using translate(StartTime, "T-:", "") and set the result to a secondary StartTime2 (or EndTime2). Then you should be able to calculate the difference more easily since there are no formatting characters.

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.