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!

Getting Max Date from Subreport

Status
Not open for further replies.

lthomas6

MIS
Aug 22, 2007
87
US
I have a report which has a subreport. The subreport has a field called Change date. I need to pull the most latest Change date. This subreport pulls data from a single table.
The main report has a parameter field called Todayprompt. The report should pull the latest changedate and this changedate needs to be less than the Todayprompt.

This is a SQL database using Crystal 10.
 
Link the sub to the main report on the {?Todayprompt} and in the record selection formula, use:

{table.changedate} < {?pm-?Todayprompt}

If you are ONLY displaying the changedate in the sub, you can insert a maximum on it at the grand total level and then suppress all other sections of the subreport.

-LB
 
I should of added this bit of information:

The subreport could have multiple dates so the records can look like this

1/2/2009 5units 30issues
2/2/2009 6units 40issues
3/5/2009 7units 50issues

If I do as you described, it shows only 1 of these records but not the latest one (in the above case 3/5/2009).
The main report is grouped by a description field. It's information is ins Group header 1ab.
The subreport information has been displayed in the Groupheader 1ab section.
There are 2 other subreports placed in groupheader1c and groupheader1d.

 
You didn't say earlier that you wanted to display anything more than the date. My earlier suggestion was to insert a maximum on the date and then suppress the other sections, so 3/5/2009 would have displayed.

To see the latest record, first set up the record selection in the sub as I mentioned earlier, and then (still in the sub) go to report->selection formula->GROUP and enter:

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

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top