Brian Dunning's FileMaker Custom Functions

RF_Audit ( LogField ; Watchlist )

Prepends an audit log of changes to fields in Watchlist to LogField

  Average rating: 4.2 (37 votes) Log in to vote

Peter Vinogradov   Peter Vinogradov

Share on Facebook Share on Twitter

  Sample input:
RF_Audit ( Data_Audit; "tf_Reps[2] & nf1")
  Sample output:
[4/28/2007 12:56:19 AM] User Admin ------ <tf_Reps[2] > to |World| from |Hello|
[4/28/2007 12:56:19 AM] User Admin ------ <nf1 > to |14| from |12|
{formatting not shown}

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Inspired by Ray Cologon's SuperLog technique, this recursive CF is used to capture changes to specified fields. Typically, the "LogField" is a text field stored in the table you want to audit. It is defined as an auto-entry calc that triggers this CF whenever modifications are made to fields in the watchlist.

This autoentry calc requires a bit more fuss than the SuperLog method, since you have to explicitly define field triggers AND a string of Watch fields to pass to the function. In the example above, Data_Audit would be defined as follows:
-------------
Let (
[
Triggers = tf_Reps[2] & nf1;
WatchList = "tf_Reps[2] & nf1";
];
RF_Audit ( Data_Audit; WatchList)
)
-------------
The tradeoff is that the function is not context-dependent, and therefore no separate logic is needed for modifications made by script.
This function also includes formatting logic for the log.
Function has not been seriously field tested or put up against a large watchlist so it may turn out to be slow under load. Feedback appreciated (pvino at optonline.net)

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.