General information
Category:
Coding, syntax & commands
SELECT table1
SCATTER NAME oTable1
SELECT table2
SCATTER NAME oTable2
*To break it out for printing the differences, you could try something like:
lcChangeString = SPACE( 0 )
IF COMPOBJ( oBeforeChange, oAfterChange )
* No changes made. Do nothing, unless you want something to happen.
ELSE
FOR i = 1 TO FCOUNT( )
lcTable1 = "oTable1." + FIELD( i )
lcTable2 = "oTable2." + FIELD( i )
IF &lcTable1. <> &Table2.
DO CASE
CASE TYPE( FIELD( i ) ) = "N"
lcChangeString = lcChangeString + " Field " + FIELD( i ) + " Changed from " ;
+ ALLTRIM( STR( &lcTable1. ) ) + " to " + ALLTRIM( STR( &lcTable2. ) ) ;
+ CHR(13)
CASE TYPE( FIELD( i ) ) = "D"
lcChangeString = lcChangeString + " Field " + FIELD( i ) + " Changed from " ;
+ ALLTRIM( DTOC( &lcTable1. ) ) + " to " + ALLTRIM( DTOC( &lcTable2. ) ) ;
+ CHR(13)
OTHERWISE
lcChangeString = lcChangeString + " Field " + FIELD( i ) + " Changed from " ;
+ ALLTRIM( &lcTable1. ) + " to " + ALLTRIM( &lcTable2. ) ;
+ CHR(13)
ENDCASE
ENDIF
ENDFOR
ENDIF
? lcChangeString
Oh yeah, if you have memo fields, you might want to SCATTER MEMO NAME oTable to include the memo fields, and maybe add other CASE's for other data types.
Good Luck,
John
P.S. sorry about the ugliness of the code, just did it real quick. Also, I don't know how to make it appear neat on these pages.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only