||Size: 812 KB
||Using the subclass & views in this example order entry workspace you can get complete auditing on tables of your choosing. Depending on your needs, this can aid in troubleshooting a particular customer's problems or required tracking of changes on sensitive data.
Datadictionary Auditing Classe
by Garret Mott
The attached Order Entry example workspace contains a DataDictionary based subclass that allows you to easily add auditing to your DataFlex based applications. Either add the subclass and base your DD's on it, or add the code to your DataDictionary subclass.
This workspace was demoed at DISD 2014 and is shared here because other developers showed interest and wanted to know how it was done.
Of course this means that the code will only audit datadictionary based changes. If you have decided to update records with procedural code then those changes will not be audited.
The workspace has been tested with Visual DataFlex 17.x and DataFlex 18.0 (beta) and with the embedded database as well as MS SQL Server 2008R2. Note comments in the code if you use MS SQL Server and choose to use Identity fields for ID's.
There are two views of interest:
The first view allows you to select the tables that you want to audit. Click the Add Tables button to add the tables in your filelist (this can be run multiple times, so you can add newly added tables), select the tables you want to audit in the list, and have all users restart the application. All changes & deletions in the checked tables will now be recorded:
The other view of interest is the actual auditing screen.
This screen quickly lets you see what has changed & has functionality for drilling down on the specific records that you are looking for.
Note that you will need to connect to your login/user identification system to get User information.
The code can be found in the folder
Please note that there are dependencies in the subclass and views that come from other projects.
Most notably Sture Anderson's VDFQuery
(this workspace has just a few of his files: anything with an extension of .utl or .nui)
and Peter Donovan's Tranlock.pkg
(Peter contributed to parts of the code in this package as well)
Please check your versions before copying any of these files so you don't overwrite newer versions!
I also recommend that you be careful what you audit. Auditing a table that gets changed a lot can create many records in a big hurry!
~ 812 kB