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 / January 2008

Tip: Looking for answers? Try searching our database.

Calculate Time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
boyemillar - 26 Jan 2008 22:55 GMT
I have created a DB in MSSQL and a couple of forms in Infopath 2003

The problem form retrieves the info from the MSSQL database and puts it in a
repeating table and i can run queries to show only the relevant data but the
main purpose of the form is to get who took the longest or shortest time per
task or day or Activity.

eg..

Date           | Name     | TIME Taken | Activity

1-Jan-2003  | Jim         | 00:15          | Invoicing

4-Jan-2003  | Tony       | 00:35          | Labelling

7-Jan-2003  | Jim         | 01:00          | Invoicing

                                  01:40  - - - Total Time Taken

The problem is when i try to calculate the Sum of the Time taken it gives a
(1.#QNAN) error.



I have tried the Infopath Blog  
http://blogs.msdn.com/infopath/archive/2007/02/21/calculating-elapsed-time-witho
ut-code.aspx


But that didnt work just wondering if im doing something wrong or if the
fact that MSSQL store additional irrelevant info such as the date field i
enter gets a time assigned (00:00) and the time field gets a Date assigned
even thoug i dont use those parts could they be affecting the calculation.
Clay Fox - 27 Jan 2008 14:55 GMT
InfoPath, especially 2003, is week in this area.

I beleive Scott's blog post could work although it is a bit complex.

You can use VBscript and use the data add and some of the other date
functions to do it.  There are soem code examples on
http://www.infopathdev.com search on dateadd

It sounds like you really want to do reporting and analysis, InfoPath often
is not the best tool for this.  I usually extract the data to SQL and then
use Web Reports or excel to connect and create reports or pivot tables.
Signature

Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum

> I have created a DB in MSSQL and a couple of forms in Infopath 2003
>
[quoted text clipped - 27 lines]
> enter gets a time assigned (00:00) and the time field gets a Date assigned
> even thoug i dont use those parts could they be affecting the calculation.
sboyd - 29 Jan 2008 14:47 GMT
On Jan 26, 5:55 pm, boyemillar <boyemil...@discussions.microsoft.com>
wrote:
> I have created a DB in MSSQL and a couple of forms in Infopath 2003
>
[quoted text clipped - 24 lines]
> enter gets a time assigned (00:00) and the time field gets a Date assigned
> even thoug i dont use those parts could they be affecting the calculation.

I think I have this figured out.  Create an Hour Field, Minute Field
and a Total_Minutes Field   Default each to 00.  Set the formula for
Total_Minutes as:
(substring(Hour, 1, 2) * 60) + (substring(Minute, 1, 2))

Create a summary expression for a sum of the Total_Minutes Field
column as:  sum(Total_Minutes)

Create a summary expression for the total Hours and Minutes as:
concat(string(round((sum(Total_Minutes) / 60) - 1)), ":",
string((sum(Total_Minutes))) - string((round((sum(Total_Minutes) /
60)) - 1)) * 60)

This worked on my form.
 
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.