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!

Crystal Report Max record formula

Status
Not open for further replies.

Palpa

Programmer
Jul 11, 2011
17
US
Hi there,

I need to display record based on the max of another record. For example, a mortgage number 1234 and 5678 have two sets of principal but in the report i need to display that mortgage number which has the highest principal. I am displaying the mortgage number in the report footer section. And can't use maximum(principal) in the record selection. Any help regarding this will be greatly appreciated.

Thanks
 
Create a formula like this for the detail section (suppress it):

whileprintingrecords;
numbervar x;
if {table.principal} = maximum({table.principal}) then
x := {table.mortgageno};

In the report footer, add a display formula:

whileprintingrecords;
numbervar x;

If the mortgage number is a string, change the variable to "stringvar".

-LB
 
That worked perfectly for me. Thanks..... and one more question, what if we have more then 2 sets of records, will the above formula works then?

Thanks again
 
What field would differentiate the two sets of records? Let's say you have a group on account#. Then you would move the display formula to the group footer, and add a (suppressed) reset formula to the group header:

whileprintingrecords;
numbervar x;
if not inrepeatedgroupheader then
x := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top