Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating elapsed time 1

Status
Not open for further replies.

BizzyLizzy

Technical User
Nov 3, 2003
77
AU
Hi all

I hope someone can help me here.

Using CR 8.5. I have a report that lists call records. This is grouped by Userid and then by date. The problem is that I need to calculate how long in total that a user was logged on for. I can do this on the 2nd group by calculating the min and max of the time field per day, which is fine, but I then run into a problem when I want to work out an overall total for a particular user. I cannot total a summary field. Has anyone got any ideas as to how I could go about doing this.

what I am aiming for is something like this.

total logged on time
PERCHARITY01 (userid) (group h1) 01:30:00
31/10/03 (group h2) 01:00:00

11:01 xxx xxx xxxx xxx xxx
1115 xxx xxx xxxx xxx xxx
11:17 xxx xxx xxxx xxx xxx
11:20 xxx xxx xxxx xxx xxx
11:21 xxx xxx xxxx xxx xxx
11:23 xxx xxx xxxx xxx xxx
12:01 xxx xxx xxx xxx xxx

01/11/03 (group h2) 00:30:00

03:01 xxx xxx xxxx xxx xxx
03:12 xxx xxx xxxx xxx xxx
03:14 xxx xxx xxxx xxx xxx
03:17 xxx xxx xxxx xxx xxx
03:21 xxx xxx xxxx xxx xxx
03:25 xxx xxx xxxx xxx xxx
03:31 xxx xxx xxxx xxx xxx

Many thanks

 
I think you would have to use the three-formula method to accumulate the times:

@reset} to be placed in the group 1 header:
whileprintingrecords;
numbervar diff := 0;

{@diff} to be placed in the group 2 header:
whileprintingrecords;
numbervar diff := diff + datediff("s",minimum({table.datetime}, {table.datetime}),maximum({table.datetime},{table.datetime});

{@displdiff} to be placed in the group 1 footer:
whileprintingrecords;
numbervar diff;

Then refer to SynapseVampires FAQ in this forum to convert the seconds in {@displdiff} to a time field.

Since this is a running total, it only displays correctly in the group 1 footer. If you must have it in the group 1 header, then I think the only solution is creating a subreport (linked by UserID to the main report) which recreates the main report. Use the accumulation formulas within the subreport, and then suppress all sections except the one displaying the total and place this in the group 1 header.

-LB
 
LB

Once again you have come charging to my rescue!! Many thanks. I will give this a go when I have got my connection to the server restored. I will let you know how I get along. The total can go in the group footer so that isnt a problem.

Cheers

Lizzy
 
LB

Many many thanks - works an absolute treat. I have saved those formulae so that I dont forget them.

Lizzy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top