reporting services - How to know if a report is already printed in SSRS? -
the user of report know if report has been printed? if report has been printed user see message report has been printed on report next time report generated. best way achieve this? in advance.
there no official documentation on how achieve this, there way of doing this.
the executionlogstorage
table contains information reports executed or exported.
when print report clicking on print button in toolbar, report "re-generated" , logged in executionlogstorage
table, format = 'image'
.
if export report tiff file, line generated format = 'image'
.
fortunately, there bytecount
column, contains "size of rendered reports in bytes." according msdn.
this bytecount
column contains 0
in case report printed, , image size if image export.
so ended following query, can execute in ssrs db:
select els.[logentryid], c.[name], c.[path], els.[parameters], els.[username], els.[timestart], els.[timeend] [dbo].[executionlogstorage] els left join [dbo].[catalog] c on els.[reportid] = c.[itemid] els.[format] = 'image' , els.[bytecount] = 0 order els.[logentryid] desc
i kept key columns here , of course can can adapt fit need, , maybe group by
have print counts per report.
important notes:
- this worked in case not officially supported, not surprised if doesn't work you.
- it can obvious people not work if user prints report in other way clicking on print report button, like:
- exporting report in format (pdf, excel, doc)
- ctrl + p page
- take server properties account:
enableexecutionlogging
must settrue
- the default
executionlogdayskept
60
adjust number accordingly
in case above query, add datasource report targetting reportserver db, , if query has result matching report, display message.
alternatively, schedule job filling db used keep track of reports printed, , query db in report.
Comments
Post a Comment