Time Difference Calc works in IP07 not IP10 - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » Time Difference Calc works in IP07 not IP10 Time Difference Calc works in IP07 not IP10 Last post 11-04-2013 07:55 AM by Hilary Stoupa. 18 replies. Page 1 of 2 (19 items) 1 2 Next > Sort Posts: Oldest to newest Newest to oldest Previous Next 02-06-2013 06:04 PM dsanchez Joined on 03-31-2011 Posts 25 Time Difference Calc works in IP07 not IP10 Reply Contact Hi guys, I've got a bit of a weird issue where my time calculations are not working in InfoPath 2010. I am running the exact same form in 2007 and it works perfectly. Does anyone have any ideas why this may be happening?I have supplied the calcs below to give you an idea.There are 3 columns, Start Time (Time), End Time (Time) and Total hours (Decimal)Start Time Condition:startTime is not blank andendTime is not blank andstartTime matches pattern Custom Pattern: 00:00:00 andExpression (number(substring(../my:endTime, 1, 2)) * 3600 + number(substring(../my:endTime, 4, 2)) * 60 - (number(substring(., 1, 2)) * 3600 + number(substring(., 4, 2)) * 60)) div 3600 >= 0Actions:Set a fields value - totalHoursValue: (((number(substring(endTime, 1, 2)) * 3600) + (number(substring(endTime, 4, 2)) * 60)) - ((number(substring(., 1, 2)) * 3600) + (number(substring(., 4, 2)) * 60))) / 3600End Time Condition: startTime is not blank andendTime is not blank andstartTime matches pattern Custom Pattern: 00:00:00 andExpression (number(substring(., 1, 2)) * 3600 + number(substring(., 4, 2)) * 60 - (number(substring(../my:startTime, 1, 2)) * 3600 + number(substring(../my:startTime, 4, 2)) * 60)) div 3600 >= 0Actions:Set a fields value - totalHoursValue: (((number(substring(., 1, 2)) * 3600) + (number(substring(., 4, 2)) * 60)) - ((number(substring(startTime, 1, 2)) * 3600) + (number(substring(startTime, 4, 2)) * 60))) / 3600Total Hours Condition: NoneAction:Set a fields value - CalculateValue: ""Set a fields value - CalculateValue: calcCould really use some feedback on the above as I have no idea why this just isnt working in 2010Cheers Filed under: DateDiff, infopath 2007, infopath 2010 02-07-2013 02:46 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Hate to bump this but anyone? 02-07-2013 03:02 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Hey - I really have no idea. First, what does "not working" mean? You are getting no result? An incorrect result? Something else?I guess if it was my form, I'd save the XML from both IP 2007 and IP 2010 and compare the actual data to make sure it is the same. Hilary Stoupa 02-07-2013 03:09 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Hilary Stoupa:Hey - I really have no idea. First, what does "not working" mean? You are getting no result? An incorrect result? Something else?Hehe good point Hilary, sorry my badWhat I meant was that the Total Hours field which should display the difference of hours does not populate, it shows nothing.Havent extracted the XML yet, the forms are exactly the same. I thought maybe it could have been template restrictions of some sort between the two products? 02-07-2013 03:17 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Microsoft usually works really hard to maintain backward compatibility. I've not run into any calc problems yet using templates from IP 2007 in IP 2010 - you are using this in filler, right? Not in the browser? Hilary Stoupa 02-07-2013 03:22 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact I will be using this form as a web browser for a SharePoint environment. I havent published it yet, so coming across the issue in design (Preview mode) 02-07-2013 03:30 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact I'd fill out both forms with the same data and compare the XML values. Have you tested your 2007 form in the browser already? Hilary Stoupa 02-07-2013 03:53 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Everything is working as expected using 2007, browser included. XML seems fine also, nothing out of the ordinaryAbsolutely stumped how the same form can work fine in one and not in the other. I even went through all the calcs and re did it in 2010 on a blank form and still the same thing!!!!GRRR! 02-07-2013 06:13 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Well- if you want to attach a copy that is working for you under the Options tab, I can take a quick look & see if I can find anything... Hilary Stoupa 02-07-2013 08:36 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 testTime.xsn Mark as Not AnswerMark as Answer... Reply Contact Thanks Hilary, appreciate it.This form I had initially created in 07, tested and works fine. Trying to run this or even replicate the calcs in 2010 just isnt happeningHope you can assist as to why this might be happening? 02-08-2013 07:26 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Time Difference Calc works in IP07 not IP10 scrn.png Mark as Not AnswerMark as Answer... Reply Contact Okay - looks like there is a difference in the XML, at least between 2007 & 2013 (my 2010 VM is feeling a bit sulky this morning). In 2013, the rules aren't firing because the pattern condition isn't being met - the time now includes the UTC offset (see attached screenshot). I removed the custom pattern requirement and the rule fired - but you'll probably want to modify the pattern to handle for the UTC offset instead in your form. Can you check the XML from 2010? Does it contain the UTC offset? Hilary Stoupa 02-08-2013 05:06 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact ohhh didnt see that .. nice pick up!Dont have access to the form till monday, will definitely check that when i go in and post the resultsQuestion though, how would i modify the pattern to handle the UTC offset? Would i use another pattern for it instead of the 00:00:00? 02-10-2013 04:57 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Ok so I've tried to add the custom pattern of 00:00 and the rule isnt firing. The rule works as you mentioned when I remove the custom pattern. I took a look at the XML and the data is showing a value of +11:00 (obviously based on the time chosen) but its still not working. I am not even sure I need that rule there?I also sent you a pm about the grandTotal column not populating. I extracted the XML and the actual column isnt even being generated in 2010. It does in 2007 though. The attached XML is the newer version, so this is a little bit different to the one I had previously used. The rules and everything are still the same 02-11-2013 08:02 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: Time Difference Calc works in IP07 not IP10 testTime.xsn Mark as Not AnswerMark as Answer... Reply Contact I would think you could use the original custom pattern and just change to using a substring of the start time - I'm attaching your sample with this modification. Save it locally, right click and select Design to open in design mode and you can see how I've changed that condition on both start and end time. As to your other question - if a node you expect to see is not in the end XML, you may want to check the Default Values (under the Data tab) and be sure it is being included by default. Hilary Stoupa 02-11-2013 04:39 PM In reply to dsanchez Joined on 03-31-2011 Posts 25 Re: Time Difference Calc works in IP07 not IP10 Mark as Not AnswerMark as Answer... Reply Contact Nice .. you were right in reference to the default values!All good with your custom pattern too, thanks for all your help Hilary! *Bows* Page 1 of 2 (19 items) 1 2 Next > Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Hi guys, I've got a bit of a weird issue where my time calculations are not working in InfoPath 2010. I am running the exact same form in 2007 and it works perfectly. Does anyone have any ideas why this may be happening?
I have supplied the calcs below to give you an idea.
There are 3 columns, Start Time (Time), End Time (Time) and Total hours (Decimal)
Start Time Condition:
End Time Condition:
Actions:
Total Hours Condition:
Action:
Could really use some feedback on the above as I have no idea why this just isnt working in 2010
Cheers
Hey - I really have no idea. First, what does "not working" mean? You are getting no result? An incorrect result? Something else?
I guess if it was my form, I'd save the XML from both IP 2007 and IP 2010 and compare the actual data to make sure it is the same.
Hilary Stoupa:Hey - I really have no idea. First, what does "not working" mean? You are getting no result? An incorrect result? Something else?
Hehe good point Hilary, sorry my bad
What I meant was that the Total Hours field which should display the difference of hours does not populate, it shows nothing.
Havent extracted the XML yet, the forms are exactly the same. I thought maybe it could have been template restrictions of some sort between the two products?
I'd fill out both forms with the same data and compare the XML values. Have you tested your 2007 form in the browser already?
Everything is working as expected using 2007, browser included. XML seems fine also, nothing out of the ordinary
Absolutely stumped how the same form can work fine in one and not in the other. I even went through all the calcs and re did it in 2010 on a blank form and still the same thing!!!!
GRRR!
Thanks Hilary, appreciate it.
This form I had initially created in 07, tested and works fine. Trying to run this or even replicate the calcs in 2010 just isnt happening
Hope you can assist as to why this might be happening?
ohhh didnt see that .. nice pick up!
Dont have access to the form till monday, will definitely check that when i go in and post the results
Question though, how would i modify the pattern to handle the UTC offset? Would i use another pattern for it instead of the 00:00:00?
Ok so I've tried to add the custom pattern of 00:00 and the rule isnt firing. The rule works as you mentioned when I remove the custom pattern.
I took a look at the XML and the data is showing a value of +11:00 (obviously based on the time chosen) but its still not working. I am not even sure I need that rule there?
I also sent you a pm about the grandTotal column not populating. I extracted the XML and the actual column isnt even being generated in 2010. It does in 2007 though. The attached XML is the newer version, so this is a little bit different to the one I had previously used. The rules and everything are still the same
I would think you could use the original custom pattern and just change to using a substring of the start time - I'm attaching your sample with this modification. Save it locally, right click and select Design to open in design mode and you can see how I've changed that condition on both start and end time. As to your other question - if a node you expect to see is not in the end XML, you may want to check the Default Values (under the Data tab) and be sure it is being included by default.
Nice .. you were right in reference to the default values!
All good with your custom pattern too, thanks for all your help Hilary!
*Bows*