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

how to get the newest order date

Status
Not open for further replies.

dreman

Programmer
Jan 16, 2002
272
US
Using 8.5, I am trying to get the latest order dates for the customer. In another word last time ordered. How would I initialize a var and compare it to the dates and then print it in the subtotal section.
Please help
dré
 
One way is to simply sort by orderdate within the customerID group. Then simply put the info you want (eg.order date, amount, etc.) in the group footer. Since you sorted by date in assending order, the last record in the group will necesarily be the last order date.
This will work very well if you are suppressing the detail section.

If you must show the detail section and you cannot accept the idea of sorting by order date (perhaps you must show by amount, etc. ) then you can do the following:

Create a running total
- Use orderdate as the field to total
- pick maximum as the summary.
- pick your customer ID group.

Place the running total in the group footer.


Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Thank you.
Yes I think Picking running total as a maximum would work. I was trying the hard way by creating a global var. I would still would like to know about the hard way if possible.
Much obliged.
dré
 
OK, here is the hard way.

You need to create three formulas.

@reset
whileprintingrecords;
shared numbervar biggest := 0;

@compare
whileprintingrecords;
shared numbervar biggest;
if {table.numberfield}>biggest then biggest := {table.numberfield}

@display
whileprintingrecords;
shared numbervar biggest;
biggest


Put @reset in the report header
put @compare in the details section
put @display in the report footer

enjoy. Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top