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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

summarize a max formula 1

Status
Not open for further replies.

BizzyLizzy

Technical User
Nov 3, 2003
77
AU
Hi all

Hope someone can help me. I am using Crystal 11 connecting to sql database with odbc.

The table I am reporting on has two number fields showing logon time and logoff time. For example.

Logon Time Logoff Time time logged on

143,125 144,125 1000
143,125 145,125 2000
143,125 150,125 7000
143,125 151,125 8000

The logoff time field is a running total for amount of time that the agent is actually logged on. This figure is being written to the database table not created by a formula in crystal. The time logged on field is a formula field that I have created {logoff time} - {logon time}. I have grouped the report on logon time and created a Max summary of time logged on. The max summary is shown in the group header for logon time. The report then goes to the next logon time with its associated running total in the logoff field.

What I now need to do is Sum the value shown in the Max summary but when I try to do this using Sum I run into the problem of 'This field cannot be summarized'. I tried putting the max value into a variable and then sumarizing the variable but that still didnt work.

Hopefully I have given enough information and that someone out there can help me.

Cheers

Lizzy
 
Variables are the way to go. I'll assume you are looking for the grand total, since you didn't mention an outer group. Create two formulas:

//{@accum} to be placed in the group header or footer section:
whileprintingrecords;
numbervar summax := summax + maximum({@timeloggedon},{table.logontime});

//{@display} to be placed in the report footer:
whileprintingrecords;
numbervar summax;

-LB
 
LB

Thanks very much. I will give this a go when I get back into the office. I had a feeling that it would be something like that but its late and I couldnt get my head around it. Story of my life - I must be getting old!

Cheers

Lizzy
 
LB

Many many thanks that worked a treat!.

Cheers

Lizzy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top