简体   繁体   English

SSRS自动从列表创建报告

[英]SSRS automatically creates reports from list

We have distinct list of Party Keys (20000 approx.) and every week we create reports for particular party keys only which has update. 我们有独特的派对钥匙清单(约20000个),并且每周我们仅为具有更新的特定派对钥匙创建报告。 Those party keys are stored in Periodic review list. 那些聚会密钥存储在定期查看列表中。

Periodic Review list = Party keys which has update 定期审核列表=具有更新的聚会密钥

So for example 1st week 180 party keys 2nd week 300 party keys 3rd week 30 party keys in periodic review list. 因此,例如,定期审查列表中的第一周180个聚会密钥第二周300个聚会密钥第三周30个聚会密钥。

So right now I have SSRS report which has parameter named Party key and by manually entering party key it will generate report. 因此,现在我有了SSRS报告,该报告具有名为Party key的参数,通过手动输入Party Key,它将生成报告。

but I want to automate the process and would like to automatically generate reports for particular party keys which has updates and stores on share folder as PDF. 但我想自动化该过程,并希望自动为特定的聚会密钥生成报告,该聚会密钥具有更新并以PDF格式存储在共享文件夹中。

if this week they have 40 party keys in review list I want to create 40 SSRS reports for those keys. 如果本周他们在审核列表中有40个派对钥匙,我想为这些钥匙创建40个SSRS报告。


Microsoft Visual Studio Enterprise 2015 Version 14.0.25420.01 Update 3 Microsoft .NET Framework Version 4.7.02053 Microsoft Visual Studio Enterprise 2015版本14.0.25420.01更新3 Microsoft .NET Framework版本4.7.02053

SQL Server Data Tools 14.0.61021.0 Microsoft SQL Server Data Tools SQL Server数据工具14.0.61021.0 Microsoft SQL Server数据工具

SQL Server Reporting Services 13.0.1701.8 Microsoft SQL Server Reporting Services Designers Version 13.0.1701.8 SQL Server报告服务13.0.1701.8 Microsoft SQL Server报告服务设计器版本13.0.1701.8

If you have an access to the reporting database, you can easily update the subscription parameter to the new key from your list and run the job that sends that subscription. 如果您有权访问报告数据库,则可以轻松地将订阅参数更新为列表中的新键,并运行发送该订阅的作业。 Basically you can have some task that takes the last Key that was processed, finds all new keys, updates the subscription, triggers the subscription job for each new key. 基本上,您可以执行一些任务,以获取最后处理的密钥,查找所有新密钥,更新订阅,为每个新密钥触发订阅作业。

Here is some query I have where you can find the link between subscription and job name: 这是一些查询,您可以在其中找到订阅和职位名称之间的链接:

SELECT     
 s.subscriptionid,
 ISNULL(c_p.Name, c.Name) AS Report, 
 msdb.dbo.sysjobs.name AS SQLAgentName, 
 CASE WHEN c.Type = 4 THEN c.Name + ' [' + s.Description + ']' ELSE s.Description end AS Description, 
MAX(s.LastRunTime) AS LastRun, s.LastStatus, 
                      s.DeliveryExtension, c.Description AS HowOften, msdb.dbo.sysjobs.job_id, msdb.dbo.sysjobs.enabled
FROM  dbo.Catalog AS c 
 LEFT JOIN dbo.Catalog AS c_p
  ON c_p.ItemID = c.LinkSourceID AND c.Type = 4
INNER JOIN dbo.Subscriptions AS s 
  ON s.Report_OID = c.ItemID 
INNER JOIN dbo.ReportSchedule 
 ON c.ItemID = dbo.ReportSchedule.ReportID 
    AND s.SubscriptionID = dbo.ReportSchedule.SubscriptionID 
INNER JOIN msdb.dbo.sysjobs 
ON CAST(dbo.ReportSchedule.ScheduleID AS varchar(100)) 
   = CAST(msdb.dbo.sysjobs.name AS varchar(100))
where msdb.dbo.sysjobs.enabled = 1
GROUP BY s.subscriptionid, c_p.Name, c.type, c.Name, msdb.dbo.sysjobs.name, s.Description, s.LastStatus, s.DeliveryExtension, c.Description, msdb.dbo.sysjobs.job_id, msdb.dbo.sysjobs.enabled

Modify the dbo.Subscription parameters and call exec msdb.dbo.sp_start_job @job_name = @JobName; 修改dbo.Subscription参数并调用exec msdb.dbo.sp_start_job @job_name = @JobName; to complete your task. 完成您的任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM