Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / February 2006

Tip: Looking for answers? Try searching our database.

Date calculations

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Johan Nilsson - 06 Feb 2006 08:40 GMT
Hello,

This question is mostly directed to S.Y.M. Wong A Ton because I read his
great solution on calculating time differences without custom code on
http://enterprise-solutions.swits.net/infopath/time-calculations-using-rules.htm

I tried his example on a new blank form and it worked perfectly and I even
managed to implement a general deduction of lunch hours in that form.
However, once tested I transferred the idea over to my real form and the time
was no longer calculated =(

Could the problem occur because I have based this real form on a database
connection (access) and I have missed to reference the fields in a correct
manner? Any suggestions where in that example I easily could have missed to
reference it correctly?
S.Y.M. Wong-A-Ton - 06 Feb 2006 09:11 GMT
First, let's clear up that it's not HIS solution, but HER solution; I'm a
female.  

If your times have the format "00:00:00" when they come out of the database,
the calculations should work. Are the times being displayed correctly in your
form? What data type are you using in your database?

---
S.Y.M. Wong-A-Ton

> Hello,
>
[quoted text clipped - 11 lines]
> manner? Any suggestions where in that example I easily could have missed to
> reference it correctly?
Johan Nilsson - 06 Feb 2006 09:30 GMT
Hi again,

I would like to start by apologising for the gender mistake.

The actual date formats are not connected to the database but is only a
reference for the user of the form to calculate that the tasks entered cover
the whole working day (you enter billing information for 8 hours but you have
been at work 9 hours so obviously have missed one hour somewhere).

The database only gathers the information what kind of tasks you have
performed and after each day you submit this information to the database.
Because it worked without problems in the blank form I thought that this
connection to the data base could cause problems somehow?

The data source layout appears exactly the same as in your examples because
I have built the 'timeEntries' and 'timeEntry' groups directly from the
'myFields'.

I hope this clarified things.

> First, let's clear up that it's not HIS solution, but HER solution; I'm a
> female.  
[quoted text clipped - 21 lines]
> > manner? Any suggestions where in that example I easily could have missed to
> > reference it correctly?
S.Y.M. Wong-A-Ton - 06 Feb 2006 09:47 GMT
No, if the database fields are independent of the time fields, the connection
should not make a difference.

I'm afraid you probably missed a step then... The only thing I can advise
you is to try composing the formula to do the totalHours calculation,
yourself. Start out small by adding a rule on the startTime that sets the
value of totalHours to only number(substring(../my:endTime, 1, 2)); see step
16. This should return the amount of hours in the endTime. If totalHours is
being filled, continue on until the full formula is constructed. When you
have it working, you can add the conditions on the rule.

What the formula does is basically determine the total amount of minutes
after midnight for the startTime and endTime, subtract them and then divide
them by 3600 to return the total amount of hours elapsed between the two
times.

Let me know how things turn out or if you are experiencing more challenges.

---
S.Y.M. Wong-A-Ton

> Hi again,
>
[quoted text clipped - 41 lines]
> > > manner? Any suggestions where in that example I easily could have missed to
> > > reference it correctly?
Johan Nilsson - 06 Feb 2006 10:29 GMT
Hi,

Excellent suggestion, it was in the conditions set up for the rule that the
error occurred and I have now corrected it.

Thanks a million for your help =)

> No, if the database fields are independent of the time fields, the connection
> should not make a difference.
[quoted text clipped - 62 lines]
> > > > manner? Any suggestions where in that example I easily could have missed to
> > > > reference it correctly?
S.Y.M. Wong-A-Ton - 06 Feb 2006 10:37 GMT
Great! And you're very welcome!
---
S.Y.M. Wong-A-Ton

> Hi,
>
[quoted text clipped - 69 lines]
> > > > > manner? Any suggestions where in that example I easily could have missed to
> > > > > reference it correctly?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.