IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    finding total time. . .
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
hello all,

just a little heads up, i'm new to the site and pretty new to wf so please bare with me if i don't describe my troubles correctly. i was wondering if anyone can help me with this task. i can find the difference in time between two seperate columns but what is troubling me is finding the total time in a specific column. which format would make this the easiest process and how would you go about executing it??

for example. . .
Time
00:00:30
00:00:08
00:00:25
Total 00:01:03

currently, the format i have is either HHIS or a concatenated field of hours, minutes, and seconds each in I2 format. i can get the total time in seconds but then it isn't in a time format.

any help would be greatly appreciated, thanks!

pt


pt

WF7.1 XPpro

"Trying is the first step towards failure." - Homer J. Simpson
 
Posts: 6 | Registered: June 01, 2007Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
I found it amazing that in many years of coding FOCUS, I have never had the occasion to SUM a time field! I don't believe there is any sort of function for this an I don't know how (or if) a standard SUBTOTAL would handle this.
You probably know that there are many ways to accomplish a given task, so here's the obvious suggestion:
simply do "modular" division on the seconds in a series of computes and you should get what you need. Assume the field containing seconds is called SECONDS.

You'll need to SET SUMMARYLINES=NEW

COMPUTE HOURS/I3=INT(SECONDS/3600);
COMPUTE MINUTES/I2=INT(SECONDS/60)-(HOURS* 60);
COMPUTE REM_SECONDS/I2L=SECONDS - (HOURS*3600) - (MINUTES*60);
COMPUTE TOTALTIME/A9=EDIT(HOURS)|':'|EDIT(MINUTES)|':'|EDIT(REM_SECONDS) ;

Then
ON TABLE SUMMARIZE
HOURS
MINUTES
REM_SECONDS
SUM. TOTALTIME


Regards,

Darin



WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java
Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K
WF Client: Linux w/WebSphere, Servlet, CGI
 
Posts: 1323 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
haha just my luck that i get to work on a task that you haven't had to work with and it's my first month of being exposed to WF! it's always something. . . Big Grin again i really appreciate your help, it worked perfectly. i did get to the point of displaying the times before, it was the SUM of the time that gave me a problem. one more quick question: is there any way to do exactly what you did except not display the individual hours, minutes, and seconds? i've tried to NOPRINT them but then the 'TOTALTIME' field displays incorrect values. i'm only asking this because i would need to replicate the same process for four more columns and all these columns would seem to be too much clutter.

thanks!

pt


pt

WF7.1 XPpro

"Trying is the first step towards failure." - Homer J. Simpson
 
Posts: 6 | Registered: June 01, 2007Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
seems to work OK for me. See below:

SET SUMMARYLINES=NEW
DEFINE FILE CAR
SECONDS/I8=10832;
END
TABLE FILE CAR
PRINT
CAR
COMPUTE HOURS/I3=INT(SECONDS/3600); NOPRINT
COMPUTE MINUTES/I2=INT(SECONDS/60)-(HOURS* 60); NOPRINT
COMPUTE REM_SECONDS/I2L=SECONDS - (HOURS*3600) - (MINUTES*60); NOPRINT
COMPUTE TOTALTIME/A9=EDIT(HOURS)|':'|EDIT(MINUTES)|':'|EDIT(REM_SECONDS) ;
ON TABLE SUMMARIZE
SUM. TOTALTIME
END


Regards,

Darin



WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java
Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K
WF Client: Linux w/WebSphere, Servlet, CGI
 
Posts: 1323 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
haha i've been frustrated all day and i want to blame it on the computer i'm using because a coworker executes the same file on her machine and it works, but in most cases it's the user so i'll take the blame. i tried, literally, right when you responded and it output the correct info. i figured something like this would be that simple but for some reason it wasn't working properly earlier. thanks for your help, it got this project rolling again!

pt


pt

WF7.1 XPpro

"Trying is the first step towards failure." - Homer J. Simpson
 
Posts: 6 | Registered: June 01, 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    finding total time. . .

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.