<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx</link><description>Updated: Now with links to both NAV 5.0 and NAV 2009 hotfixes 
 /Claus Lundstr&amp;oslash;m 
 ****** 
 In several partners meetings I have heard this requests over and over again. 
 Claus, when we are planning an upgrade of Classic reports to RDLC reports</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10421724</link><pubDate>Tue, 28 May 2013 10:50:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10421724</guid><dc:creator>Torben Wind Meyhoff - MSFT</dc:creator><description>&lt;p&gt;@Benjamin&lt;/p&gt;
&lt;p&gt;We do not have any run always triggers for reports, but what you can do is to make the same logging code inside the Codeunit1::FindPrinter trigger. C/AL SaveAsX methods invoked from the server will not invoke the trigger.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10421724" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10419207</link><pubDate>Thu, 16 May 2013 08:57:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10419207</guid><dc:creator>Benjamin Hochstetter</dc:creator><description>&lt;p&gt;Thank you for the interesting post. Is it planned to implement the trigger also for RTC. We are planing to upgrade our NAV 2009 RTC Customers to NAV 2013. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10419207" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10415131</link><pubDate>Tue, 30 Apr 2013 17:12:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10415131</guid><dc:creator>DTACCONI</dc:creator><description>&lt;p&gt;PART III&lt;/p&gt;
&lt;p&gt;3.	And Commit the temp table records into the Report Log table in Codeunit 1 Function LoginEnd&lt;/p&gt;
&lt;p&gt;LogInEnd()&lt;/p&gt;
&lt;p&gt;IF LogInWorkDate &amp;lt;&amp;gt; 0D THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp;IF LogInWorkDate = LogInDate THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;WORKDATE := TODAY&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ELSE&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;WORKDATE := LogInWorkDate;&lt;/p&gt;
&lt;p&gt;IF USERID &amp;lt;&amp;gt; &amp;#39;&amp;#39; THEN BEGIN&lt;/p&gt;
&lt;p&gt; &amp;nbsp;IF UserSetup.GET(USERID) THEN BEGIN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;UserSetupFound := TRUE;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;RegisterTime := UserSetup.&amp;quot;Register Time&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;END;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;IF NOT UserSetupFound THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;IF GetGLSetup THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;RegisterTime := GLSetup.&amp;quot;Register Time&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;IF RegisterTime THEN BEGIN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;LogOutDate := TODAY;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;LogOutTime := TIME;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;IF (LogOutDate &amp;gt; LogInDate) OR (LogOutDate = LogInDate) AND (LogOutTime &amp;gt; LogInTime) THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Minutes := ROUND((1440 * (LogOutDate - LogInDate)) + ((LogOutTime - LogInTime) / 60000),1);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;IF Minutes = 0 THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Minutes := 1;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;UserTimeRegister.INIT;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;UserTimeRegister.&amp;quot;User ID&amp;quot; := USERID;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;UserTimeRegister.Date := LogInDate;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;IF UserTimeRegister.FIND THEN BEGIN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;UserTimeRegister.Minutes := UserTimeRegister.Minutes + Minutes;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;UserTimeRegister.MODIFY;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;END ELSE BEGIN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;UserTimeRegister.Minutes := Minutes;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;UserTimeRegister.INSERT;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;END;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;END;&lt;/p&gt;
&lt;p&gt;END;&lt;/p&gt;
&lt;p&gt;ReportLogManagement.CommitReportLogUsage; //ADD THIS LINE&lt;/p&gt;
&lt;p&gt;Hope this helps more in deploy the content of this blog without any side issue.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10415131" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10415130</link><pubDate>Tue, 30 Apr 2013 17:11:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10415130</guid><dc:creator>dtacconi</dc:creator><description>&lt;p&gt;PART II&lt;/p&gt;
&lt;p&gt;1.	Create a brand new SINGLE INSTANCE codeunit (called e.g. “Report Log Management”) like the following&lt;/p&gt;
&lt;p&gt;these are the GLOBALS &lt;/p&gt;
&lt;p&gt;Name &amp;nbsp; &amp;nbsp;DataType &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Subtype &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Length&lt;/p&gt;
&lt;p&gt;tempReportLog &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Record &amp;nbsp;Report Log &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;ReportLog &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Record &amp;nbsp;Report Log &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;counter &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Integer &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;entryNo &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Integer &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;these are the FUNCTIONS&lt;/p&gt;
&lt;p&gt;WriteTempReportLogUsage(ReportId : Integer)&lt;/p&gt;
&lt;p&gt;IF tempReportLog.FINDLAST THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp;counter := tempReportLog.&amp;quot;No.&amp;quot; + 1&lt;/p&gt;
&lt;p&gt;ELSE&lt;/p&gt;
&lt;p&gt; &amp;nbsp;counter := 0;&lt;/p&gt;
&lt;p&gt;tempReportLog.&amp;quot;No.&amp;quot; := counter;&lt;/p&gt;
&lt;p&gt;tempReportLog.&amp;quot;User ID&amp;quot; := USERID;&lt;/p&gt;
&lt;p&gt;tempReportLog.&amp;quot;Report ID&amp;quot; := ReportId;&lt;/p&gt;
&lt;p&gt;tempReportLog.&amp;quot;Date Time&amp;quot; := CURRENTDATETIME;&lt;/p&gt;
&lt;p&gt;tempReportLog.INSERT;&lt;/p&gt;
&lt;p&gt;CommitReportLogUsage()&lt;/p&gt;
&lt;p&gt;tempReportLog.RESET;&lt;/p&gt;
&lt;p&gt;IF tempReportLog.FINDSET THEN REPEAT&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ReportLog.&amp;quot;No.&amp;quot; := 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ReportLog.&amp;quot;User ID&amp;quot; := tempReportLog.&amp;quot;User ID&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ReportLog.&amp;quot;Report ID&amp;quot; := tempReportLog.&amp;quot;Report ID&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ReportLog.&amp;quot;Date Time&amp;quot; := tempReportLog.&amp;quot;Date Time&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ReportLog.INSERT;&lt;/p&gt;
&lt;p&gt;UNTIL tempReportLog.NEXT = 0;&lt;/p&gt;
&lt;p&gt;2.	Then you can change your code in Codeunit 1 to populate Temp Table runtime with the following (just refined without logging NAS activity, if any)&lt;/p&gt;
&lt;p&gt;OnReportRun(ReportId : Integer)&lt;/p&gt;
&lt;p&gt;IF GUIALLOWED THEN&lt;/p&gt;
&lt;p&gt; &amp;nbsp;ReportLogManagement.WriteTempReportLogUsage(ReportId);&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10415130" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10415129</link><pubDate>Tue, 30 Apr 2013 17:10:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10415129</guid><dc:creator>dtacconi</dc:creator><description>&lt;p&gt;PART 1&lt;/p&gt;
&lt;p&gt;Many thanks to Timo to show us a way to implement this @best (of course you do not have the buffered report for still-on-line users). But as wisely stated, this should give the big picture related to logged report.&lt;/p&gt;
&lt;p&gt;I have to say that I have touched the RUNMODAL problem with my own fingers and I just would like to add here AS IS and simple Proof Of Concept a way to get rid of RUNMODAL together with gathering the appropriate info.&lt;/p&gt;
&lt;p&gt;From this blog you just have to create / change the following (again thanks Timo to illustrate a good investigation path):&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10415129" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10413604</link><pubDate>Wed, 24 Apr 2013 10:14:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10413604</guid><dc:creator>Timo Lässer [MSDynamics.de]</dc:creator><description>&lt;p&gt;I also got the RUNMODAL error and solved this with a SingleInstance Codeunit:&lt;/p&gt;
&lt;p&gt;The OnReportRun in Codeunit 1 calls a function of my SI Codeunit with the ReportID as parameter which saves all needed informations in a temporary table (defined as global Var in the SI Codeunit).&lt;/p&gt;
&lt;p&gt;In Codeunit 1 - LoginEnd, I call another function of my SI Codeunit, which writes the records of the temporary table to the database.&lt;/p&gt;
&lt;p&gt;This way, I can run reports modal and doesn&amp;#39;t need a commit.&lt;/p&gt;
&lt;p&gt;Sure, the statistics are updated at the end of the user session and new entries will be lost if the client crashes in any way, but in total, you will get an overview of the report usage anyway.&lt;/p&gt;
&lt;p&gt;If you need exact informations in real time, this workaround is nothing for you. ;-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10413604" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10367703</link><pubDate>Mon, 12 Nov 2012 12:54:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10367703</guid><dc:creator>Rolf Kaufmann</dc:creator><description>&lt;p&gt;Hi Claus,&lt;/p&gt;
&lt;p&gt;I have the same problems as others with this code.&lt;/p&gt;
&lt;p&gt;Report.RUNMODAL causes a Transaction Error.&lt;/p&gt;
&lt;p&gt;and I found out, that your Statement:&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;gt;&amp;gt;OnReportRun is called before the first trigger of the report.&lt;/p&gt;
&lt;p&gt;is not correct. I stepped though the code with the debugger and fuction 120 in CU1 is executed AFTER the Report.OnInit Trigger.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10367703" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10274067</link><pubDate>Tue, 28 Feb 2012 22:00:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10274067</guid><dc:creator>Jon K</dc:creator><description>&lt;p&gt;In regards to the RUNMODAL issue and avoiding a commit, an easy work around I am using is to create a table of &amp;quot;exceptions&amp;quot; and put&lt;/p&gt;
&lt;p&gt;if not get.exceptiontable(reportid) then begin&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;end;&lt;/p&gt;
&lt;p&gt;around Claus&amp;#39; code in codeunit 1 and as users come up with the RUNMODAL error, populate the exceptions table with the Report IDs. &amp;nbsp;Not a perfect solution but still gets you a list of reports users are using by merging the two tables.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10274067" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10231995</link><pubDate>Tue, 01 Nov 2011 09:07:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10231995</guid><dc:creator>Thomas K.</dc:creator><description>&lt;p&gt;Any new information/experience with this feature, performance-wise?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10231995" width="1" height="1"&gt;</description></item><item><title>re: Updated: How to log report usage</title><link>http://blogs.msdn.com/b/nav/archive/2011/06/23/how-to-log-report-usage.aspx#10195816</link><pubDate>Mon, 15 Aug 2011 19:45:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10195816</guid><dc:creator>Thaddeus R</dc:creator><description>&lt;p&gt;I do see one potential problem with this Mike. &amp;nbsp;If a report is being run as part of some larger process, then when you COMMIT after the insert you would also commit any writes up to that point from the surrounding larger process. &amp;nbsp;I personally don&amp;#39;t think this is worth the risk, since the larger enclosing process (or the report) could encounter an error and then you would be leaving partially committed data.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10195816" width="1" height="1"&gt;</description></item></channel></rss>