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

Related data for maximum and minimum values 3

Status
Not open for further replies.

pastasalad

Programmer
Mar 27, 2003
38
GB
Hi Folks

My report is grouping on transaction type from a selected dataset. In each group footer I am showing the maximum value of transaction within this transaction type and the minimum value of transaction within this transaction type. So far so good.

However, as well as the max and min transaction values for each type, I also need to show the related transaction date for these two transactions (i.e. the date of the maximum transaction value and the date of the minimum transaction value). In other words I need a second piece of data from the record containing the max transaction and the same for the record containing the min transaction.

Anybody got any suggestions here?

Thanks if you can help

Marc Kozlowski
 
You need to use a variable for this. In the group header section write a formula:

WhilePrintingRecords;
Datevar mindate:=date(0,0,0)

In the details section:
WhilePrintingRecords;
Datevar mindate:=if {YourDateField}<mindate then mindate:={YourDateField};

In the group footer:
WhilePrintingRecords;
Datevar Mindate;

Make a similar set of 3 formulas for maxdate. Also, if you repeat your group headers at the top of every page, insert the statement &quot;Not inRepeatedGroupHeader&quot; as line 2 of the first formula, or else you will be resetting the min date to 0-0-0 on every page.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
Thanks dgillz. Good work. I actually needed to combine date variables with amount variables to get the dates relating to the max and min amounts, but the structure you provided did most of the work for me.
 
Waaah! I've made several attempts to give dgillz's above posting a star but your server keeps dropping me out when I try. Could somebody please post a star to dgillz for me? Thanks.
 
But what if the field that you wanted to get the min and max values from is not {YourDateField}, but still you need to display {YourDateField} for the records with min and max {transaction} values???? Seems to me that the solution above is just displaying the min value from {YourDateField} itself.

I am facing a very similar problem... what I need is to find the highest amount in the {productivity} field in our Employees table, then I need to display the first and last name for the resulting employeeID in the group footer.

can someone give any help?? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top