To comment on:
"Sorry, I don't understand why do you store the 'changed value for this
field' in the audit form, but don't store the 'value of the field before
the changed occured'."
If you create an audit entry on submit for all the fields that are
audited on a form, then capture the transactional changes to these
fields on an individual basis, you have a cronology of the
transactional changes per field since the beginning, showing the
time/user making the change. The data in this format is pretty easy
to render in a table field for users to view the audit data on a per
field basis. I think this is a pretty good design because users
usually want to know when one field changed (assigned to, status,
etc.) and not all of the audit data lumped together.
A few more details/areas for expansion:
- There is some tuning that is pretty necessary when designing
something like this. I wont go into gory detail, but if you have
questions, do ask. An issue you may run into is if you audit values
on submit, and you attempt to create 10 tasks on a change request at
the same time. Don't fret though, if written properly this does not
present an issue.
- Update the old audit records with an end date/time
- Calculate time diffs (business / real) between the start/end times
(good for reporting)
- Use the status field to mark the record either current or historic
(makes reporting and indexing easier). This can be used to allow
users to view all the last changes for audited fields for a given
request, instead of on a per field basis.
- Don't use the form/entryid to relate audit records, use a guid
instead (This indexes much better than the form/eid, and the guid (FID
179) is available to filters on submit without any special handling)
- If the audit form is lean, storage shouldnt present an issue.
Figure that you can get each row into 250 bytes. 10m rows (which is a
very large number) only equates to 2.5gb (plus the history table
data)). (avg of 100 audit records per 100,000 entries)
On the subject of getting the value of the field before it changed, I
encourage you to just store the audit data in submit so that you
already have the value before it changed. Performing a lookup on each
field that changed after the fact will cause you to incur a
select/GLEWF against your ticketing form for each field, which can be
expensive.
Axton
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
(Support: mailto:support@arslist.org)