Comparing record with original when saving - alternate

George Simon GSimon at americanriverintl.com
Wed Jan 17 11:28:27 PST 2007


Ken writes:

> 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.

> @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  <--- Isn't this a little dangerous for the inexperienced?

 
 
George Simon Sr. Programmer
Information Technologies
American River International


-----Original Message-----
From: filepro-list-bounces+george=worldest.com at lists.celestial.com [mailto:filepro-list-bounces+george=worldest.com at lists.celestial.com] On Behalf Of Kenneth Brody
Sent: Wednesday, January 17, 2007 1:55 PM
To: Fplist
Subject: RE: Comparing record with original when saving - alternate

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
==========

--

_______________________________________________
Filepro-list mailing list
Filepro-list at lists.celestial.com
http://mailman.celestial.com/mailman/listinfo/filepro-list


More information about the Filepro-list mailing list