Damien Dennehy
Damien Dennehy

Reputation: 4064

SSRS 2005 - Restricting parameters

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.

Upvotes: 0

Views: 670

Answers (2)

Thomas
Thomas

Reputation: 1

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.

Upvotes: 0

JC Ford
JC Ford

Reputation: 7066

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.

Upvotes: 3

Related Questions