SSRS使用报告目录报告来超链接到报告管理器上的其他报告

时间:2020-02-05 16:33:25

标签: reporting-services ssrs-2008 ssrs-2012

我有一个查询,该查询使用ReportServer数据库检索有关服务器上可用报告的信息。我创建了带有标准表(无分组)的“报告目录”,该表列出了所有单个报告,其文件夹以及每个报告的运行次数。有没有一种方法可以使每个报告名称超链接以将用户带到那些报告?

如果有帮助,请在此处查询:

SELECT  
c.Name,
REPLACE(c.[Path], c.Name, '') as Path,
COUNT(*) as TimesRun
FROM [ReportServer].[dbo].[ExecutionLog](NOLOCK) el
INNER JOIN [ReportServer].[dbo].[Catalog](NOLOCK) c ON el.ReportID = c.ItemID
WHERE c.Type = 2
GROUP BY c.Name,c.[Path]
order by TimesRun desc

1 个答案:

答案 0 :(得分:0)

我通过将一些URL文本(例如“ http://”)与现有列连接来创建“ ReportURL”列。该URL还将所有空格替换为“%20”,因此我在查询中也做了相同的操作。在我的SSRS表中,在文本框属性上,将操作设置为转到URL ,并使用表达式 = Fields!ReportURL.Value ,做到这一点。

SELECT  
c.Name,
REPLACE(c.[Path], c.Name, '') as Path,
   REPLACE(('http://'+
   LEFT(el.InstanceName, CHARINDEX('\', el.InstanceName, CHARINDEX('\', el.InstanceName)) - 1)+ 
   '/reports/report'+
   c.Path),' ','%20')
   as ReportURL,
COUNT(*) as TimesRun
FROM [ReportServer].[dbo].[ExecutionLog](NOLOCK) el
INNER JOIN [ReportServer].[dbo].[Catalog](NOLOCK) c ON el.ReportID = c.ItemID
WHERE c.Type = 2
GROUP BY c.Name,c.[Path], el.InstanceName
order by TimesRun desc