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

SubReport parameter based on a date range

Status
Not open for further replies.

johnstrang

Technical User
Dec 8, 2003
60
CH
Hi Everyone,
Another question about subreport parameters - using CR 8.5 with a direct connection to an Oracle database.

I have a Parameter {?Time Period} to select the time period required - there are 3 available selections
"Last Week"
"Last Month"
"Year to Date"

I have 2 formulas to calculate the beginning and end dates of the selected time period
Code:
{@first_date}
select {?Time Period}
case "Last Week" : DataDate + ( -(dayofweek(DataDate)) - 5)
case "Last Month" : DateSerial(Year(DataDate), Month(DataDate) -1, 1)
case "Year to Date" : DateSerial(Year(DataDate), 1, 1)
end

{@last_date}
select {?Time Period}
case "Last Week" : DataDate + ( -(dayofweek(DataDate)) + 1)
case "Last Month" : DateSerial(Year(DataDate), Month(DataDate), 1 - 1)
case "Year to Date" : DataDate
end

I want to make the dates returned by these formulas available to my subreport, so I can have Record Selection based on
{Creation_Date} >= {@first_date} and
{Creation_Date} <= {@last_date}

I have tried this, but the formulas {@first_date} and {@last_date} don't run because they don't recognise the parameter {?Time Period}

I've tried various options but for some reason I can't achieve what I need, other than by having another prompt for {?Time Period} for the subreport.

If anyone can help I'd be very grateful,

John
 
I think you could add {?TimePeriod} to the subreport and then link the subreport parameter to the same parameter in the main report when you do the subreport links. THis should result in only one prompt. Be sure to use the dropdown list in the lower left to get {?TimePeriod} from the subreport instead of {?PM-?TimePeriod}.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top