zeos - How to find out which field was changed in a delphi 6 TZTable via ZeosLib -


i have tztable (zeoslib) bound dbgrid need know particular tfield changed user.

i tried

if not (tapositionenartnrgh.newvalue = tapositionenartnrgh.oldvalue)     showmessage('articlenumber changed'); 

i placed code in

  • beforepost, onupdaterecord, afterpost

but in debugger oldvalue newvalue. how check field changed?

you can use updatestatus : tupdatestatus this. example:

  1. set ztable.cachedupdates true;
  2. create new calculated field named "status".
  3. to show old value example of field "fname" create new calculate field named "fnameoldvalue"
  4. in oncalcfields event use:

    procedure tdm1.ztable1calcfields(dataset: tdataset); begin   if ztable1.updatestatus in [usmodified]     begin       ztable1status.value := 'modified';       ztable1fnameoldvalue.value := ztable1fname.oldvalue;     end   else     ztable1status.value := 'unmodified' end; 

result :

enter image description here

edit:

you can detect field level changes like:

if ztable1.updatestatus in [usmodified]   begin     := 0 ztable1.fields.count - 1       begin         if ztable1.fields[i].oldvalue <> ztable1.fields[i].newvalue            -- field       end;    end;  

Comments