UFN_REPORT_GETREPORTPATH

Returns the path to a report.

Return

Return Type
nvarchar(max)

Parameters

Parameter Parameter Type Mode Description
@REPORTID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_REPORT_GETREPORTPATH
(
    @REPORTID uniqueidentifier
)
returns nvarchar(max)
as begin

    declare @path nvarchar(max);
    declare @rootpath nvarchar(max);

    select @rootpath = rtrim(replace(REPORTDATASOURCE, '\', '/')) from INSTALLATIONINFO;
    select @rootpath = LEFT(@rootpath, LEN(@rootpath) - CHARINDEX('/', REVERSE(@rootpath)));

    with XMLNAMESPACES('bb_appfx_report' as rp)
    select @path = @rootpath + '/' + (replace(RC.REPORTSPECXML.value('(/rp:ReportSpec/rp:Folder/node())[1]', 'nvarchar(max)'), '\', '/') + '/' + RC.NAME)
    from REPORTCATALOG RC
    where RC.ID = @REPORTID

    return @path
end