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

Using Maximum

Status
Not open for further replies.

Melzer

Technical User
Jul 30, 2001
11
US
I want to show the amount field (which can may return more than one entry per record) but only in the group where the maximun has been reached. Any ideas?

For example.

Record 1 can have 5 sub records. I want to show the amounts for Record 1 but only where the 5th subrecord appears. I've tried grouping by everything but that tends to hide some of the amounts. I've tried using maximun but can't use it in conjunction w/ my amount field. I have Crystal 8.5 and 9.

Thanks in advance.
 
You should post example data and expected output, your terminology is "creative" and will cause many to just be guessing.

If you want to show the first value of a grouping later at only the end of the grouping alongside the last value, try something akin to the following:

Create a formula containing:

In the group header:
@InitTheFirstGroupValue
whileprintingrecords;
numbervar 1stval :=0;

Create a second details section by right clicking and selecting insert section below, place all values to display in the second details section, and in the 1st detail section place:
@NabTheFirstGroupValue
whileprintingrecords;
numbervar 1stval;
if on firstrecord
or
previous({table.groupfield}) <> {table.groupfield} then
1stval := {table.groupfield}

Suppress both of the above formulas.

In the second details section place a formula with something akin to the following to display the first value for the group:

@NabTheFirstGroupValue
whileprintingrecords;
numbervar 1stval;
1stval

If you want to suppress the value of the first row of each group, go into the suppress formula and place something like:

onfirstrecord or previous({table.groupfield}) <> {table.groupfield}

That should get you close.

-k

-k
 
It's a little hard to tell what results you are trying to achieve. If you want to display only the &quot;subrecord&quot; row which contains the maximum amount for each &quot;record&quot;, then:

1- Group on {RecordID}

2- Place the following formula in the group select statement:

{SubRecord.Amount} = Maximum({SubRecord.Amount},{RecordID})

Maybe this won't work, since you mention that you can't use maximum with your amount field. Is this a calculated field? What is your formula? Is it a running total? A little more information would help.

-LB



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top