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!

Selecting maximum record

Status
Not open for further replies.

cabz

Technical User
Dec 11, 2006
3
US
I am a new Crystal reports user(v8.5). I have a table that has multiple effective dates. I have grouped by the personID but I just need to select the most recent effective date for this person. Simply using the Maximum funtion in my selection criteria results in an error stating that it must be eval later. What is the easiest way to do this?

 
You can sort descending by date and then drag the date field into the group header. Or you can go to report->selection formula->GROUP and enter:

{table.date} = maximum({table.date},{table.personID})

This will only display the most recent record; however, non-group selected records will still contribute to inserted summaries across groups, so you would need to use running totals for any calculations like that.

-LB
 
Thank you. Now that I have the most recent records in the Grpheader I only want those where an active indicator is = "Y".

If I add this to the select statement I lose records that I need to evaluate and it gives me false results. I added conditional formatting to the group header to suppress these records. So now what I "see" is correct. But my totals are a mess. Can a running total be created that only looks at the unsuppressed group header records?


 
Go to report->selection formula->GROUP and enter:

{table.date} = maximum({table.date},{table.personID}) and
{table.active} = "Y"

Then use the group selection method for the most recent date. The running totals will only pick up the displayed records.

-LB
 
Thank you, this worked perfectly!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top