Geting The Last Run Date For Your Reports

2 minute read time.

A customer running version 6 recently requested the ability to retrieve the last execution date of all reports run within Sage ERP X3 as they wanted to deactivate reports that had not been run in a while. They were seeking to ensure only business critical reports were available for execution and to get an idea of just what reports users were running. Part of the reasons they wanted to do this was for performance tuning. One way you can do that (I can think of a few) is to check the client PC for a cached copy of the report. This works on version 6 and below. Take note though, there is a gotcha (isn’t that always the case?).

Checking the Client PC

For customers that use the desktop client on version 6 you may have noticed that the desktop client will cache a local copy of the report on the client PC, usually somewhere around this location:

  • C:\ProgramData\Sage\Safe X3 Client\V1\Data\X3_vapp-x3v6-03_1806\ENG\Report.

Once you know that you can check the client PC for these reports, then check the Last Accessed Date for the report file within Windows.

The NtfsDisableLastAccessUpdate Gotcha

Here’s the gotcha though, the Last Accessed Date inside Windows isn’t accurate and that is by design as it turns out. Over time Microsoft realized that they could reduce the disk access consumption by offering a registry tweak to disable the act of updating the last accessed date for directories and files. This is particularly interesting for file servers per se, but is it applicable to Sage ERP X3? Probably not, but you might make a case that there are some directories inside the Sage ERP X3 folder structure on disk that experience a higher amount of IO. For example, the TRA directory for Sage ERP X3, if not properly pruned, can eventually end up with a large number of files within it. Still, is it on the level of a file server for your domain, again, likely not.

If you’d like to get more accurate last accessed dates, here’s information on where that registry key is located:

Some additional information on performance tuning Windows in general (search NtfsDisableLastAccessUpdate inside here as well for more details)

Key takeaway:

  1. The last accessed date can be re-enabled
  2. It is turned off on newer operating systems by default to diminish disk access resources needs by the OS

 

Using Powershell to Export Last Accessed Date By Report By Computer

To help with my customer’s requirements I created a Powershell script to do the following:

  1. Retrieve the list of the locally cached report files and list them by name with the last accessed date
  2. Export that list to a csv file
  3. Set the name of the file equal to the computer name + user name.csv

 

You find an example of that on github here.

A shortened version of that script looks like the following:

Get-ChildItem -Path "C:\ProgramData\Sage\Safe X3 Client\V1\Data\X3_vapp-x3v6-03_1806\ENG\Report" `
   | select name, *time `
   | Export-Csv -Path c:\temp\ReportRunDates.csv `
   -Encoding ascii -NoTypeInformation

The "X3_vapp-x3v6-03_1806" will be specific to your system, so ensure you've set that correctly. 

Enjoy!