SQL Server Reporting Services 2005 - 如何处理空报表
我想知道如果 Excel 工作表为空,是否可以不附加 Excel 工作表,如果为空,则可以在电子邮件中写一条不同的注释。
当我进入报告传送选项时,没有这样的配置。
编辑:我正在运行 SQL Server Reporting Services 2005。
下面提到的一些可能的解决方法:
我应该研究这些东西。
I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty.
When I go to report delivery options, there's no such configuration.
Edit: I'm running SQL Server Reporting Services 2005.
Some possible workarounds as mentioned below:
MSDN: Reporting Services Extensions
NoRows and NoRowsMessage properties
I should look into these things.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信答案是否定的,至少不是开箱即用的。 鉴于 RS 中包含的打印交付扩展示例,编写您自己的交付扩展应该不难。
I believe the answer is no, at least not out of the box. It shouldn't be difficult to write your own delivery extension given the printing delivery extension sample included in RS.
是的,我认为这是不可能的。 您可以使用表的“NoRows”属性在没有返回数据时显示一条消息,但这不会阻止附加报表。 但至少当他们打开 Excel 文件时,它可以打印出您的自定义消息,而不是空文档。
Yeah, I don't think that is possible. You could use the "NoRows" property of your table to display a message when no data is returned, but that wouldn't prevent the report from being attached. But at least when they opened the excel file it could print out your custom message instead of an empty document.
在其他地方找到了这个...
我对这个问题有一个干净的解决方案,唯一的缺点是系统管理员必须创建和维护计划。 请尝试以下步骤:
为包含所有必需收件人的报告创建订阅。
将订阅设置为每周在昨天运行(即,如果今天是星期二,则选择星期一),计划从今天的日期开始,到今天的日期停止。 本质上,此计划永远不会运行。
在 SQL Management Studio 中打开新创建的作业,转到步骤并复制 SQL 行(它将如下所示: EXEC ReportServer.dbo.AddEvent @EventType='TimedSubscription', @EventData='1c2d9808- aa22-4597-6191-f152d7503fff')
使用实际计划在 SQL 中创建您自己的作业,并使用类似以下内容的内容:
IF EXISTS(SELECT your test criteria...)
BEGIN
EXEC ReportServer.dbo.AddEvent @EventType=... 等
END
Found this somewhere else...
I have a clean solution to this problem, the only down side is that a system administrator must create and maintain the schedule. Try these steps:
Create a subscription for the report with all the required recipients.
Set the subscription to run weekly on yesterday's day (ie if today is Tuesday, select Monday) with the schedule starting on today's date and stopping on today's date. Essentially, this schedule will never run.
Open the newly created job in SQL Management Studio, go to the steps and copy the line of SQL (it will look something like this: EXEC ReportServer.dbo.AddEvent @EventType='TimedSubscription', @EventData='1c2d9808-aa22-4597-6191-f152d7503fff')
Create your own job in SQL with the actual schedule and use something like:
IF EXISTS(SELECT your test criteria...)
BEGIN
EXEC ReportServer.dbo.AddEvent @EventType=... etc.
END
我成功地使用了数据驱动订阅和包含我的订阅者的表,数据驱动订阅查询如下所示:
在传递设置中,收件人是包含我的电子邮件地址的数据列。
如果内部查询未返回任何行,则不会发送任何电子邮件。
为了您的目的,您可以利用“包含报告”和“评论”传送设置。
我想像这样的数据驱动订阅查询将适合您:
然后在配置订阅的传递设置时在适当的字段中使用这些列。
I have had success with using a Data-Driven Subscription and a table containing my subscribers, with the data-driven subscription query looking like this:
In the delivery settings, the recipient is the data column containing my email addresses.
If the inner query returns no rows, then no emails will be sent.
For your purposes, you can take advantage of the "Include Report" and "Comment" delivery settings.
I imagine that a data-driven subscription query like this will work for you:
Then use those columns in the appropriate fields when configuring the delivery settings for the subscription.