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!

Max or Latest Date 1

Status
Not open for further replies.

mischief911

Technical User
Jan 14, 2002
21
US
I am trying to retrieve the latest/last date from a table which could have multiple records for a given user in it. I just want to display only one date on the report, the last date of contact by the user.

I tried doing a Summary using a Max filter on the date field to no avail.

Any ideas would be greatly appreciated.

Thank you
 
You could do this in SQL or within Crystal you can
simply group by user, sort all users by contact date,
suppress the detail section, and display the information you need in the group footer.
The group footer always shows the data for the last record
in the group.

Cheers,
- Ido ixm7@psu.edu
 
No such luck getting this Maximum({Closed.date}) to work and also a Maximum({Closed.Date},{Userid}) with no luck. This is proving to be my biggest challenge!
 
This is probably because the date is not in the detail section.

You could add a formula

WhilePrintingRecords;
DateVar LastDate;

LastDate := {table.LastDate};


then just display "LastDate" when you want it...after the detail have been proccessed

Hope this helps....Jim
 
Still unable to get this Max Date issue resolved. It is the last issue I have with this particular report.

I reread prior posts and tried putting the Date field in the Detail section then creating a running total on this date field for every change in userid. No Luck with that either.

Anything else I should try?
 
The solution I suggested above doesb't require any computation of a max date. Please try it and if it doesn't work, explain exactly what doesn't work.

Cheers,
- Ido ixm7@psu.edu
 
Ido,

I did try what you suggested the "whileprinting..." formula and I didn't have any luck. I placed the date field in the detail section and the formula in the group header and then in the detail section. Nothing (no date) appears when I print out the report.

Anything else I should try?
 
Put the Max(your_date_field) in the Report Footer if all you want is the maximum value across all the records in the report.

If you want a Max(your_date_field) per group, then put the Max() in the group footer.
 
The method that IdoMillet suggests should work. Just remember to place the contact.date field in the detail section and suppress the detail section. Then place all your fields including the contact.date field in the group footer. Last step click on the sort icon(A-Z) select the contact.date field as a sort field in ascending order. This should work I use this method on many of my reports. I have a bit more complicated problem. The subject is Complicated Problem...Need Your Expertise! Can you guys please read my post and give me idea. Thanks
Bryan
 
Mischief911,

It isn't clear to me if you want one date per user for multiple users, or if the report only inlcudes one user.

Also, the term "retrieve" can cause confusion. CR can't select the last one without evaluating all of them, which requires 'retrieving' all of them. If by retrieve you mean only display the MAX, then CR can do this. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top