Comparing record with original when saving - alternate

Kenneth Brody kenbrody at bestweb.net
Wed Jan 17 10:54:53 PST 2007


Quoting Wally Turnbull (Wed, 17 Jan 2007 13:07:52 -0500):

> The thread was getting long so am top posting - sorry.
>
> Several good solutions have been posted but I use the following
> variation because I think it is faster as it does not do any I/O
> unless there is a change.  It also allows one log file to monitor
> changes for any/all files.
[...]

You can also use an array to save the original field values upon
entering update mode.  Here is a simple example that shows the
original and current value each time you leave a field.

==========
    1  Then: end
@entsel
    2  Then: show "Update the record to show new/original value test"
    3  Then: end
    4  Then: dim OrigVal[999] ; dim CurrVal[999]:1
    5  Then: declare Count(4,.0)
@update
    6  Then: Count = "1"
loop     If: Count le numfield(-)
    7  Then: OrigVal[Count] = CurrVal[Count] ; Count = Count + "1" ;
               goto loop
    8  Then: screen
    9  Then: end
@wlf*    If: @fd gt "999"  ' Skip dummy fields
   10  Then: end
   11  Then: mesgbox "Orig: " & OrigVal[@fd] & "\nCurr: " & CurrVal[@fd]
   12  Then: end
==========

--
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list