是否可以获取可以通过电子邮件发送给同事的已执行报告(包括所选参数值)的URL?他们可以按照链接获得与我相同的选择参数。
答案 0 :(得分:0)
这绝对是可能的,我喜欢在报告上创建mailto支持链接,用户可以点击该链接发送给我(将要查看他们的问题的人)与他们使用的报告的完全链接,并附带参数。
Technet Page: Passing a Report Parameter Within a URL
以下是我们可以分解的示例网址:
http://server/reportserver?/Sales/Northwest/Employee销售报告& rs:Command = Render& EmployeeID = 1234
“http://” - 显然所有链接都是一样的
“server” - ssrs服务器的名称
“的reportserver?” - 访问报表服务器报表的虚拟目录: 您可以通过登录服务器并检查Reporting Services配置管理器设置来找到此信息。如果没有人定制您的,则默认值为“reportserver”。
“/ Sales / Northwest / Employee Sales Report /”:报告的路径,包括报告名称
“& rs:Command = Render”:只是命令ssrs服务器呈现报告
“& EmployeeID = 1234”:您感兴趣的参数部分。在这种情况下,EmployeeID是报告中参数的确切名称(不是显示名称),显然1234是链接的值。 / p>
答案 1 :(得分:0)
我找到了解决方案!它在SharePoint模式下与SSRS一起使用!!! 报表参数及其值存储在表的xml字段中的ReportingServiceTemDB中。您可以使用存储过程来获取并生成URL(更改或添加存储过程输入参数[SERVERNAME],[ReportingServiceDB],[ReportingServiceDBTempDB],[ReportLibraryName])。 然后创建共享数据集并在带有输入参数的报告中使用数据集:
@parUserName = User!UserID; @parReportName = Globals!ReportName
ALTER PROCEDURE [dbo].[p_guCreateUrlWithParameters]
@parUserName varchar(250),
@parReportName varchar(250),
@parTimeout int = 10
AS
/*
set @parUserName = 'REGION\11BelyaevDA'
set @parReportName = 'rptDITRequestTactical.rdl'
set @parTimeout = 120 //sec
*/
declare @results varchar(4000)
begin try
select
@results = coalesce(@results+'&rp:','') + url -- you have to change parameter prefix if you are using report server not in sharepoint mode
from
(
select
res.UserName,
res.Report,
res.CreationTime,
res.parName,
res.parType,
(case when res.parType = 'DateTime' then replace(convert(varchar,cast(res.parValue as date),103),'/','.') else res.parValue end) as parValue,
(res.parName+'='+(case when res.parType = 'DateTime' then replace(convert(varchar,cast(res.parValue as date),103),'/','.') else res.parValue end)) as url
from
(
select distinct
x.UserName,
x.Report,
x.CreationTime,
Paravalue.value('../../Name[1]', 'VARCHAR(250)') as parName,
Paravalue.value('../../Type[1]', 'VARCHAR(250)') as parType,
Paravalue.value('../../Prompt[1]', 'VARCHAR(250)') as parLable,
Paravalue.value('../../MultiValue[1]', 'VARCHAR(250)') as parMultiValue,
Paravalue.value('.[1]', 'VARCHAR(250)') as parValue
from
(
SELECT top 1
s.CreationTime
,s.SessionID
,u.[UserName]
,c.[name] [Report]
,d.[name] [DataSource]
,s.[ReportPath]
,convert(XML,s.[EffectiveParams]) as ParameterXML
,DATEDIFF(minute,s.[CreationTime],GETDATE()) [RunningTimeMinutes]
FROM [ServerName].[ReportingServiceDBTempDB].[dbo].[SessionData] as s with (NOLOCK)
JOIN [ServerName].[ReportingServiceDB].[dbo].[Catalog] as c with(NOLOCK)
ON RIGHT(c.Path, CHARINDEX('/', REVERSE(c.Path)) -1) = RIGHT(s.ReportPath, CHARINDEX('/', REVERSE(s.ReportPath)) -1) and c.Type = 2 -- if you are using report server not in sharepoint mode - use '\'
JOIN [ServerName].[ReportingServiceDB].[dbo].[DataSource] as d with(NOLOCK)
ON c.ItemID = d.ItemID
JOIN [ServerName].[ReportingServiceDB].[dbo].[Users] as u with(NOLOCK)
on u.UserId = s.ownerID and u.UserName = @parUserName
WHERE
RIGHT(c.Path, CHARINDEX('/', REVERSE(c.Path)) -1) = @parReportName -- if you are use report server not in sharepoint mode - use '\'
and datediff(ss,s.CreationTime, getdate()) < @parTimeout
order by s.Expiration desc
) as x
CROSS APPLY ParameterXML.nodes('//Parameters/Parameter/Values/Value') p ( Paravalue )
) res
) link
end try
begin catch
select isnull(@results,'')
end catch
set @results = 'http://[SERVERNAME]/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/[ReportLibraryName]/'+@parReportName+'&rp:'+@results -- you have to change link if you are using eport server not in sharepoint mode
select isnull(@results,'')
GO