views:

32

answers:

2

I have a SSRS 2005 report that lists data between two particular dates.

I want to restrict the user from selecting more than a week's worth of data (so they can't do something silly and attempt to view five years worth).

Is there any way do do a comparsion on parameters that are being entered, and prompt the user if they fail certain rules? I can alter the parameters so that there would be one date parameter, and a numeric parameter only allowing 1-7 numbers (therefore allowing them to select a start date and go back 1-7 days), but that's not as user friendly as selecting a start and end date.

The report passes the data into a Stored Procedure, and I've done a check there to validate the parameters, but this isn't useful as the user isn't told if there's a problem.

I'm told this is possible in 2008 but unfortunately I'm stuck with 2005 for the time being.

+2  A: 

If you throw a custom exception in the stored proc, the user will be shown the message you provide.

RAISERROR('The dates are too far apart. Try using a smaller date range.', 10, 1)

It isn't pretty, but it does the job.

JC
A: 

Perhaps instead of the numeric parameter 1-7, you could put a dataset in the query with values date - 1 through date - 7 and present that list in dropdown form as the possible values for the second date field.

Thomas