简体   繁体   中英

How to sort Subscription display in SSRS/SQL Server 2016

Is there anyway to customize how subscriptions for a report are sorted? We have several subscriptions for one particular report and they all follow a certain naming scheme for the description. However, like subscriptions aren't displayed together because the subscriptions don't appear to be sorted.

I've attempted to do the following:

  • Search for all procedures that referenced anything about subscriptions and added an "order by description" to the end of the query it ran, but this had no effect.

If I'm not mistaken, the sort must be taking place on the client side jQuery API it uses, but I've not figured out a way to force it to sort.

This is SQL Server 2016 Reporting Services (SSRS 2016).

I don't think that you can/should customize the manage report page of SSRS, but if you want a list of subscriptions and the ability to filter and sort it, then this query may be helpful. It is an aggregation of several other queries found on the internet.

select 
    c.Path as [ReportPath],
    us.UserName as [SubscriptionOwner],
    uc.UserName as [ReportModifiedBy],
    s.LastStatus as [LastStatus],
    s.LastRunTime as [LastRun],
    Convert(XML,[ExtensionSettings]).value('(//ParameterValue/Value[../Name="TO"])[1]','nvarchar(1024)') as [To],
    Convert(XML,[ExtensionSettings]).value('(//ParameterValue/Value[../Name="CC"])[1]','nvarchar(1024)') as [CC],
    Convert(XML,[ExtensionSettings]).value('(//ParameterValue/Value[../Name="RenderFormat"])[1]','nvarchar(1024)') as [Render Format],
    Convert(XML,[ExtensionSettings]).value('(//ParameterValue/Value[../Name="Subject"])[1]','nvarchar(1024)') as [Subject],
    TARDIS.dbo.getSubscriptionParameters (s.SubscriptionID) as [parameters]
from ReportServer.dbo.Subscriptions s
    join ReportServer.dbo.Catalog c on c.ItemID = s.Report_OID
    join ReportServer.dbo.ReportSchedule rs on rs.SubscriptionID = s.SubscriptionID
    join ReportServer.dbo.Users uc on uc.UserID = c.ModifiedByID
    join ReportServer.dbo.Users us on us.UserID = s.OwnerId
    join msdb.dbo.sysjobs j on j.name = CONVERT(nvarchar(1024),rs.ScheduleId)
order by
    1, 2

You can also get a list of subscriptions via PowerShell, like this:

$server = 'http://myserver.mycompany.com/reportserver'
$site = '/'

$rs2010 = New-WebServiceProxy -Uri "$server/ReportService2010.asmx" -Namespace SSRS.ReportingService2010 -UseDefaultCredential
$subscriptions = $rs2010.ListSubscriptions($site)
$subscriptions | Sort-Object -property path,owner,SubscriptionID -Unique | select Path, Owner, SubscriptionID 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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