OpenNTF.org - Tracking Changes to Fields (No
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Tracking Changes to Fields (Notes & Web) 
Rating:
Rating: 4 , Number of votes: 1 
Contributor:
Chris Crompton 
Category:
Lotus Formula 
Type:
Example Code 
Notes Version:
R6.x 
Last Modified:
09 Dec 2005 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Here is a sample db with some fields used to keep track of which fields on a document have been changed along with before & after values. The sample works in both Notes & Web (although sometimes the tooltip text wouldn't display for me in Notes.


Field updates are displayed in a log on the document. If you hover over a specific update, you'll see the actual field change ("field xx changed from 'before' to 'after'") as tooltip text.

Usage / Example
You write out your fields to track in the Tracking_FieldsList field.

You write out your field labels in the Tracking_FieldLabels field.

The Tracking_OriginalValues field keeps track of the original values. (Place this field before your fields you need to track. Also not it must be computed when composed.)

Tracking_ChangedValues and Tracking_ChangedFields keep track of changed fields. (Place these fields after your fields to track.)

The updateChangeLog field writes the changes to log fields on the form.
Code Attachments
ChangeLogSample.nsf (384 Kbytes)
 Comments
Posted by Dave Myers on 09/14/2005 03:21:56 PMThis is great tool, but doesn't handle multivalue fields
Hi,
This is a great idea for easy audit logs. I'm working on trying to figure out a solution for handling multivalue fields as there seems to be a problem in recording the original value. I will post a solution as soon as I figure one out (I hope).
Posted by Bob Pratico on 08/02/2006 03:10:01 PMmodified to work with multivalue fields?
Anyone modified this yet to work with multivalue fields?
Bob
Posted by Foghorn Leghorn on 08/17/2006 10:55:42 AMmulti value check
Check the total length of the values in the field, e.g. @Length(@Implode(fieldvalue). If the length is differnt on save than on open, the field changed. Don't worry about whats in the field, just log the change. Anyone inspecting the log will be able to see the change.
If you don't like that: Sort the values in the shadow field on open and on save sort the edit field then do a standard transaction-type processing between the two. You may or may not want to @Unique the fields before sort, depending on the application.
psuedo:
If not ((ShadowFieldValue[1] = Edit FieldValue[1])... & ...(ShadowFieldValue[n]) = (EditFieldValue[n])) then field is modified so log it else do nothing.
F.L.
Posted by Christian Zalto on 07/22/2009 08:40:08 AMNot really working well
Tried a while to get this running but it doesn't work reliable. There are changes logged that never took place and field names not appearing where they should appear.
 Add your comment!