Brian Dunning's FileMaker Custom Functions

JSON_Audit_Log

Log changes of different fields as JSON

  Average rating: 5.0 (1 vote) Log in to vote

Thomas Siebert   Thomas Siebert - Show more from this author
http://www.t-seabird.de

Share on Facebook Share on Twitter

  Sample input:
JSON_Audit_Log ( self ; field1 & field2 )
  Sample output:
{
"field1" :
[
{
"timestamp" : "29.03.2023 19:11:21",
"username" : "Admin",
"value" : "hello"
},
{
"timestamp" : "29.03.2023 19:11:26",
"username" : "Admin",
"value" : "world"
}
],
"field2" :
[
{
"timestamp" : "29.03.2023 19:10:41",
"username" : "Admin",
"value" : 1
},
{
"timestamp" : "29.03.2023 19:10:46",
"username" : "Admin",
"value" : 2
}
]
}

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

The Function loggs every change from given fields within a record.

Create a Text field in your table using a descriptive FieldName like "_json_log".
Use Fields from the same table only

Use the CF in the Calculation such as:
JSON_Audit_Log ( self ; field1 & field2 )

uncheck "Do not evaluate if all referenced fields are empty"
uncheck "Do not replace existing value of field (if any)"

check "Prohibit modification of value during data entry"

deactivate indexing
use "Unicode" as default language

 

Comments

cupertino   cupertino
Apr 20, 2023
Hi Thomas
Thanks for this useful feature. I installed it to monitor three critical fields in my database. Basically it works fine, only with some records I get the following syntax errors:

? * Line 1, Column 1
Syntax error: value, object or array expected.
* Line 1, Column 3
Extra non-whitespace after JSON value.

Can you help me? Thanks.
 
cupertino   cupertino
Apr 20, 2023
Hi Thomas
Thanks for this useful feature. I installed it to monitor three critical fields in my database. Basically it works fine, only with some records I get the following syntax errors:

? * Line 1, Column 1
Syntax error: value, object or array expected.
* Line 1, Column 3
Extra non-whitespace after JSON value.

Can you help me? Thanks.
 
Thomas Siebert   Thomas Siebert
Apr 26, 2023
Try to reset the field using {}
 
Andrew Mallison   Andrew Mallison
Mar 18, 2024
I added two fields to log but it tracked only one that I didn't choose.
 
Andrew Mallison   Andrew Mallison
Mar 18, 2024
I added two fields to log but it tracked only one that I didn't choose.
 
Thomas Siebert   Thomas Siebert
Mar 18, 2024
How did you do it?
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: