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

Formula-No Parameter Please

Status
Not open for further replies.

ForMe2

Technical User
Joined
Jan 16, 2007
Messages
15
Location
US
I'm looking for a way to print the record closest to the current date without using a parameter. (I don't want a parameter because this will eventually be a subreport.)

Example:
The last date a product was produced.

 
Use Report->Selection Formula->Record and place:

{table.date} <= currentdate

Then use Report->Selection Formula->Group and place:

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

-k
 
ForMe2, synapsevampire's solution is probably the best answer for the specific question, but you can use parameters with subreports. They may get requested separately, or you can pass a value from the main report down to the subreport.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
How you approach this really depends upon how you intend to use date and the subreport, and upon your version. Another approach you could use in higher versions is to create a command to return the highest date per group, as in:

select max(table.`date`),table.`prodID`
from table
group by table.`prodID`

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top