CLEAR CD SYS(2023) CREATE DATABASE trydatabase * put a CHECK field rule CREATE TABLE trytable (ff1 I NULL DEFAULT RECNO(), ff2 i NULL DEFAULT NULL CHECK ff2#0) FOR K=1 TO 10 APPEND BLANK ENDFOR * without buffering, all ok CURSORSETPROP("Buffering",1) * a single violation TRY REPLACE ff2 WITH 0 CATCH * _TALLY is number of record processed ? "ff2", ff2, "tally IS ", _TALLY, "ok, i aspected 0 because the record is not replaced" ENDTRY * NOW, apply record buffering CURSORSETPROP("Buffering",3) * a single violation TRY REPLACE ff2 WITH 0 CATCH * FIRST BUG OR PROBLEM * i aspected ff2 not replaced, and _TALLY = 0 but ... ? "ff2" , ff2 && <<<<========== buffer value is replaced !!!!!!! * at this point, VFP Team have two choices, * a) _TALLY is the count of replacements ---> 1 * b) _TALLY is the count of valid replacements ---> 0 ?? " tally IS ", _TALLY, " -> NO valid replacements" * now the row buffer is filled with the invalid field value * Now is necessary a TABLEREVERT !!!! for remove invalid value ? TABLEREVERT() * or replace the field with OLDVAL() for not lose other buffered fields value !!!! * very usefull a new FIELDREVERT() function ENDTRY * multiple violations TRY REPLACE ff2 WITH IIF(ff1<3,1,0) ALL CATCH * now i aspected _TALLY is the count of valid replacements ---> 2 ? "_TALLY IS ", _TALLY , " I aspected 2 , but surprise _Tally is ZERO !!" * NOW I HAVE LOST THE NUMBER OF RECORDS UPDATES =TABLEREVERT() COUNT FOR ff2=1 ? "but updated records are ", _tally ENDTRY * THIS OCCURS BECAUSE _TALLY IS NOT UPDATED WITHIN THE RECORDS PROCESSING COMMAND * AND WHEN A ERROR OCCUR, THE PROCESS IS INTERRUPTED AND _TALLY IS NOT FILLED * This have other limitations, because if _TALLY was refreshed * during RECORDS PROCESSING COMMAND i can implement commands like this: REPLACE ff2 WITH 7 ALL WHILE _TALLY<2 FOR ff1%2=0 * AND THIS CAN STOP COMMAND AFTER TWO REPLACEMENT CLOSE DATABASE DELETE DATABASE trydatabase DELETETABLESFabio