SSRS导航选项

时间:2018-06-19 14:13:55

标签: reporting-services ssrs-2016

我正在寻求增强我的SSRS实例(2016)的Web界面。是否可以使用选项卡或左侧报告层次结构树在报告之间导航?

目前,我所看到的只是能够升级到某个级别,然后显示该级别的可用报告列表的功能。

是否有其他选择或公认的解决方案可以在SSRS中更好地导航?

引起我注意的一件事是文档地图。有没有一种方法可以创建可用于报表导航的文档结构图?不是浏览报告,而是浏览另一个报告?

谢谢

迈克

1 个答案:

答案 0 :(得分:0)

我使用报告查看报告服务器上所有已部署的报告。它可以使您融入其中。图标是指向文件夹/报告的链接。我还显示了执行计数和订阅计数。 XML代码超出了此答案中的限制。 Here's a shortcut to the XML/rdl file in GitHub。将XML复制并粘贴到文本文件中,然后使用扩展名.rdl重命名该文本文件。

报告预览的屏幕截图

ssrs report listing

用于报告的SQL

/*
+-----------------------------------------------------------------------------
| Purpose:  To search deployed reports on the report server
| Note:     SQLCmdMode Script (from the SSMS menu [Query]|[SQLCMD Mode])
+-----------------------------------------------------------------------------

:setvar _server "YourServerNameHere"
:setvar _database "ReportServer"
--:setvar _user "***username***"
--:setvar _password "***password***"
--:connect $(_server) -U $(_user) -P $(_password)
:connect $(_server)

USE [$(_database)];
GO


DECLARE @ReportFolder AS VARCHAR(100)
DECLARE @ReportName AS VARCHAR(100)
DECLARE @ReportDescription AS VARCHAR(50)
DECLARE @CreatedBy AS VARCHAR(50)
DECLARE @CreatedDate AS DATETIME
DECLARE @ModifiedBy AS VARCHAR(50)
DECLARE @ModifiedDate AS DATETIME
DECLARE @ReportDefinition AS VARCHAR(50)
DECLARE @SearchFor AS VARCHAR(50)
DECLARE @SearchType AS VARCHAR(50)
DECLARE @all_value AS VARCHAR(50)

SET @ReportFolder = '<ALL>'
SET @ReportName = NULL
SET @ReportDescription = NULL
SET @CreatedBy = NULL
SET @CreatedDate = NULL
SET @ModifiedBy = NULL
SET @ModifiedDate = NULL
SET @ReportDefinition = NULL
SET @SearchFor = NULL
SET @SearchType = NULL
SET @all_value = '<ALL>'

*/

;WITH
report_users 
AS
(
    SELECT [UserID], [SimpleUserName] = UPPER(RIGHT([UserName], (LEN([UserName])-CHARINDEX('\', [UserName])))) FROM dbo.[Users]
)
,
report_catalog
AS
(
    SELECT    
          rpt.[ItemID]
        , rpt.[CreatedById]
        , rpt.[ModifiedById]
        , rpt.[Type]
        , rpt.[Name] 
        , rpt.[Description]
        , rpt.Parameter
        , [CreationDate] = CONVERT(DATETIME, CONVERT(VARCHAR(11), rpt.[CreationDate], 13))
        , [ModifiedDate] = CONVERT(DATETIME, CONVERT(VARCHAR(11), rpt.[ModifiedDate], 13))
        , [ReportFolder] = SUBSTRING(rpt.[Path], 2, Len(rpt.[Path])-Len(rpt.[Name])-2) 
        , rpt.[Path]
        , [URL_ReportFolder] = 'http://' + Host_Name() + '/Reports/browse/'  + SUBSTRING(rpt.[Path], 2, Len(rpt.[Path])-Len(rpt.[Name])-2)
        , [URL_Report] = 'http://' + Host_Name() + '/Reports/report/'  + SUBSTRING(rpt.[Path], 2, Len(rpt.[Path])-Len(rpt.[Name])-2)  + '%2f' + rpt.[Name]
        , [ReportDefinition] = CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), rpt.[Content]))  
    FROM 
        dbo.[Catalog] AS rpt
    WHERE 
        1=1
        AND rpt.[Type] = 2
)
SELECT    
      rpt.ItemID
    , rpt.[Name]
    , rpt.[Description]
    , rpt.[Parameter]
    , [ReportCreatedBy] = urc.[SimpleUserName]
    , [ReportCreationDate] = rpt.[CreationDate]
    , [ReportModifiedBy] = urm.[SimpleUserName]
    , [ReportModifiedDate] = rpt.[ModifiedDate] 
    , rpt.[ReportFolder]
    , [ReportPath] = rpt.[Path]
    , rpt.[URL_ReportFolder]
    , rpt.[URL_Report]
    , rpt.[ReportDefinition]
    , [CommandText] = rpt.[ReportDefinition]
    , el.[ExecutionLogCount]
    , sc.[SubscriptionCount]
    , [SearchForStr] = ISNULL(@SearchFor, ' ') 
FROM  
    report_catalog AS rpt 
    LEFT JOIN (SELECT [ExecutionLogCount] = COUNT([ReportID]), [ReportID] FROM dbo.[ExecutionLog] GROUP BY [ReportID]) el ON el.[ReportID] = rpt.[ItemID]
    LEFT JOIN (SELECT [SubscriptionCount] = COUNT([Report_OID]), [Report_OID] FROM dbo.[Subscriptions] GROUP BY [Report_OID]) sc ON sc.[Report_OID] = rpt.[ItemID]
    LEFT JOIN report_users AS urc ON rpt.[CreatedById] = urc.[UserID] 
    LEFT JOIN report_users AS urm ON rpt.[ModifiedById] = urm.[UserID]
WHERE 
    1=1
    AND (@all_value IN (@ReportFolder) OR rpt.[ReportFolder] IN(@ReportFolder))
    AND (@CreatedBy IS NULL OR urc.[SimpleUserName] LIKE '%' + @CreatedBy + '%')
    AND (@CreatedDate IS NULL OR rpt.[CreationDate] >= @CreatedDate)
    AND (@ModifiedBy IS NULL OR urm.[SimpleUserName] LIKE '%' + @ModifiedBy + '%')
    AND (@ModifiedDate IS NULL OR rpt.[ModifiedDate] >= @ModifiedDate)
    AND (
            @SearchFor IS NULL 
            OR (
                (rpt.[Name] LIKE '%' + @SearchFor + '%' AND (@all_value IN(@SearchType) OR 'Report Name' IN(@SearchType)))
                OR (rpt.[Description] LIKE '%' + @SearchFor + '%' AND (@all_value IN(@SearchType) OR 'Report Description' IN(@SearchType)) )
                OR (PATINDEX('%' + @SearchFor + '%', rpt.[ReportDefinition]) > 0 AND (@all_value IN(@SearchType) OR 'Report Definition' IN(@SearchType)) )   
                )
        )