SSRS 2005 - 限制参数
我有一份 SSRS 2005 报告,其中列出了两个特定日期之间的数据。
我想限制用户选择超过一周的数据(这样他们就不能做一些愚蠢的事情并尝试查看五年的数据)。
有什么方法可以对输入的参数进行比较,并在用户不符合某些规则时提示用户?我可以更改参数,以便有一个日期参数和一个仅允许 1-7 个数字的数字参数(因此允许他们选择开始日期并返回 1-7 天),但这并不像选择那样用户友好开始和结束日期。
该报告将数据传递到存储过程中,我在那里进行了检查以验证参数,但这没有用,因为用户不会被告知是否存在问题。
有人告诉我这在 2008 年是可能的,但不幸的是我暂时只能选择 2005 年。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在存储过程中抛出自定义异常,用户将看到您提供的消息。
RAISERROR('日期相距太远。尝试使用较小的日期范围。', 10, 1)
虽然不太漂亮,但它可以完成任务。
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.
也许您可以将数据集放入查询中,并使用值 date - 1 到 date - 7 来代替数字参数 1-7,并以下拉形式显示该列表作为第二个日期字段的可能值。
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.