[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 OrigChanged()
 Check for change in the origin of all the gets (MASTERVAR clause).
------------------------------------------------------------------------------

 Syntax:

     OrigChanged() --> <lChanged>

 Returns:

     OrigChanged() returns a logical indicating if the any of the variables
     specified with the MASTERVAR clause have changed.  The intention of this
     function is to allow a check of originating fields in a database against
     changes.  In an object environment RLOCKS() are not performed until
     update time.  If the original data in the databases have changed we
     must inform our user and act according to his/her reaction.

 Example:

     The following example ALERTs the user if data has changed prior to
     updating the data base.

     LOCAL cName := CLIENT->NAME
     LOCAL nAge  := CLIENT->AGE
     LOCAL lBackDoor

     @ 10, 10 SAY "Name:" GET cName ORIGIN { || CLIENT->NAME }
     @ 11, 10 SAY "Age: " GET nAge ORIGIN { || CLIENT->AGE }
     READ

     IF Updated() .AND. !__KillRead()

        lBackDoor := OrigChanged()

        IF !lBackDoor .OR. ;
           ( Alert( "Data Record Has Been Changed By Another User.;" + ;
             "Overwrite Their Changes?", { "No", "Yes" }, , .T. ) == 2 )

           WHILE !RLOCK() ; END

           CLIENT->NAME := cName
           CLIENT->AGE  := nAge

           COMMIT
           UNLOCK

        ENDIF

     ENDIF


 Files:  Library is CUACLIP.LIB.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson