Try OpenEdge Now
skip to main content
Core Business Services - Security and Auditing
Auditing : Querying and Reporting on Audit Data : Audit data querying and reporting : Query guidelines
Query guidelines
The best ways to query the audit data depend on the selection criteria being used and the order that the data needs to be reported in.
Ordinarily, the primary query table will be the _aud-audit-data table, as this contains the most useful indexes. If searching for changes to a particular field, however, you will find it more efficient to start with the _aud-audit-data-value table and to join to the _aud-audit-data table using the _Audit-data-guid. Note that separate child records in the _aud-audit-data table are not always available, depending on the field and field policy settings.
The audit data table itself has two recursive joins, one for the application context and one for the audit event group, pointing at another audit data record containing the details and joined using the _Audit-data-guid primary key. Recursive joins are currently not natively handled in ProDataSets, so manual coding is required to handle this.
One approach is to add code to a ProDataSet afterrowfill event procedure to manually populate additional temp-tablefields with the context and event group information inline, using buffers to read the information. A variation of this approach is to add separate temp-tables for the context and audit event group records, which might be useful if all the data in the record is required for reporting. The important thing is to take away the complexity of the recursive joins for the consumer of the report data.
It is likely that the same context or audit event group will span many audit data records, so rereading this data each time could be inefficient. Other possibilities are to make a separate pass through the audit data for the context and audit event groups specifically, or to build up a list of the audit event group and context IDs used across the extracted audit data and to make a second pass using this list as the driver to obtain the additional information required. The best approach will depend on criteria for report performance and how the context and audit event groups have been used.
Give similar considerations to the client session records, as there will be many audit data records for a single client session.