JavaScript Editor js editor     Web development 

Main Page

Returns the record number for the next modified record in a buffered table or cursor.

GETNEXTMODIFIED(nRecordNumber [, cTableAlias | nWorkArea] [, lNoFire])



Specifies the record number after which GETNEXTMODIFIED(В ) searches for the next modified record. Specify 0 for nRecordNumber to determine the first record in the table or cursor that has been modified.

Specifies the alias of the table or cursor for which GETNEXTMODIFIED(В ) returns the number of the next modified record.

Specifies the work area of the table or cursor for which GETNEXTMODIFIED(В ) returns the number of the next modified record. If you do not specify an alias or work area, GETNEXTMODIFIED(В ) returns the record number for the next modified record in the currently selected table or cursor.

Specifies that all firing of rules are suppressed.

Return Value



GETNEXTMODIFIED(В ) returns 0 if there are no modified records after the record you specify. Because of this, if you modify only one record, to verify its modification you must first use the GO TOP command to position the cursor before the changed record. A record is considered modified if the contents of any of its fields are changed in any way (even if the original field contents are restored) or the record's deletion status is changed.

GETNEXTMODIFIED(В ) can operate only on tables and cursors for which table buffering is enabled. Table buffering is enabled with CURSORSETPROP(В ).

Since triggers are unaffected by GETNEXTMODIFIED(В ), lNoFire suppresses only field and record rules, and the "Uniqueness of index ID is violated" error. lNoFire prevents the flushing of temporary data, such as data stored in controls or updates made to the current record, to the underlying cursor.


The following code example uses the GETNEXTMODIFIED( ) Function to examine changes to records in a buffered table. Typically, changes are made through user interaction with a form. For the purposes of this example, the data is updated using the SQL UPDATE command. As preparation to demonstrate the GetNextModified method, the example code opens a table in the sample database, sets optimistic row buffering, and the updates the table.

The GetNextModified(В ) function is called with 0 as the parameter to get the record number of the first record updated in the buffer. A loop processes the updated records based on the the value of MaxOrdAmt. Changes are discarded if the value of MaxOrdAmt is greater than 8500. GetNextModified(В ) is called again, this time with the current record number, to get the next modified record in the buffer. If GetNextModified(В ) returns 0, there are no more modified records to process and the loop ends. TableRevert(.t.) is called to discard all changes and restore the sample data to it's original state.

В Copy Code
LOCAL lnCurRec
OPEN DATABASE (HOME(2) + 'data\testdata')
USE Customer

* Enable table buffering.
=CURSORSETPROP("Buffering", 5, "customer") 

* Increase MAXORDAMT by 10% for customers in Mexico.
UPDATE Customer SET MaxOrdAmt=MaxOrdAmt * 1.1 WHERE Country = "Mexico"

* Start with the first modified record.

* DO until all modified records are processed.

   * Move to the current modified record.
   GOTO (m.lnCurRec)

   * Process modified row here.
   ? Customer.Company, Customer.MaxOrdAmt
   IF Customer.MaxOrdAmt > 8500
   ?? Customer.MaxOrdAmt

   * Get the next modified record from here.
   lnCurRec = GETNEXTMODIFIED(m.lnCurRec)

   IF m.lnCurRec = 0 && No more modified records.


=TABLEREVERT(.T.)  && Restore sample data and discard all changes.

See Also

JavaScript Editor js editor     Web development