Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging changes

Status
Not open for further replies.

shotokanbuff

Programmer
Jun 16, 2003
1
US
Hello;


I would like to track a "date modified" for one field within my
database. I don't care about historical data or who made the change,
I just simply want to post a current date into [field 2] whenever ANY
change is made to [field 1]. [field 1=Address, field 2=Address Edit
Date].


I'd like to do this when the user is exiting [field 1] if possible.
Any suggestions?


Donnie
 
Edit-->Prefrences--->Document
When colsing 'filename' Perform 'this_script'
make a
this_script:
to Insert current Time/Date UserName in fields
OR
u can make a text/date field with an auto-insert (date/time.modification.username...)but this field will get populated as the file is accessed and worked on...not on exit/close of the file. But anyway, if user modifes a file you want to record it right then since there could possibly be an issue/crach/problem when the connection is lost on exit and running a srcipt at that time will not help the situation....
I don't think you can track the field change but rather a record change
All the best!
 
This can be done to watch any number of fields to see if they have changed with a script as mentioned above. To do this you need to have 2 fields with the data in them, you compare the data to be sure the value is the same, then take action if the data does not match.

Add a verify field to match the fields you wish to verify. For example, to verify the address field that is existing in your solution, create a new field called address verify. Do this for each of the fields you want to track.

The script will be self updating and modifying like this.

if(Address 1 verify = Address 1)

end script

Else
SETFIELD(Address 1 Verify, Address 1)
SETFIELD(History, history&"paragraph symbol"&dateformula&" Change Address 1"&address 1")

The paragraph symbol puts a carage return in the history so the field can stack the history using one line for each history entry. This will allow you to print or view the history and have it displayed in a cronological order. Scitch the history and the rest of the code and the latest entry will be displayed on top of the past history.

This concept can track as many fields as you would like using the same history field.


if(Address 1 verify = Address 1)

Else
SETFIELD(Addess 1 Verify, Address 1)
SETFIELD(History, history&"paragraph symbol"&dateformula&" Change Address 1: "&address 1")

if(City verify = City)

Else
SETFIELD(City Verify, City)
SETFIELD(History, history&"paragraph symbol"&dateformula&" Change City: "&City")

Notice I dropped the "end script" for multiple if statements. The history in this case stacks the changes made and the results could look like this in the history field:

6/10/2003 Change Address 1: 1234 anywhere
6/12/2003 Change City: Timbucktoo
6/15/2003 Change Address: 1234 Anywhere, Suite 100

This script allows you to keep the current history without erasing the old history.

I hope this helps. Let me know if you have any scripting quesitons to make this work.

Marty
 
Donnie

This can be done also by calculation fields if you have no way to trigger the scripts. There is software that can trigger a script upon exit of a field if you wish to purchase. The other option is to create two additional fields and they will be has follows.

First Field

Address verify set to auto enter address upon a new record being entered. Old records will have to be set thru a script to update this field.

Second Field

If(address = address verify , "" , address & " was changed to " & address verify & " at " & TimeToText(Status( CurrentTime)) & " " & DateToText(Status( CurrentDate)))

When address changes it will set the second field to this text. It will keep that until address verify is reset to address. This can be done daily or when checked by script. Keep in mind that it will not track more than one change at a time. So if you think you have mutli changes during the day you will need to trigger a script as stated by Marty to track all changes.

Mike
 
I think Waves in Motion have a plug-in to keep track of changes. Sorry I can't be specific; I have seen reference to such a plug-in somwehere.

Cheers,
Paul J.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top