How do I get the "modified" state of a datatable in the BeforePost event?

Hi,

I’m using business helper classes - as per http://wiki.remobjects.com/wiki/Strongly_Typed_DataTables_and_Business_Helper_Classes_(Delphi)

I am overriding the beforepost event in order to set some “audit” fields, e.g. last updated by/when. If a datatable is set to Edit, and the user then hits Save without making any changes (yes, they do that even if they really should hit cancel), the Post event is still called, and so these values are still updated. Is there a way to find out if any field values have actually changed before updating these field values? I could see no IsModified property anywhere.

I am aware of the Delta.count > 0 check, but this is before post so the delta hasn’t been updated.

Thanks for any advice.

Stuart

Hello,

You could check if your dataset was modified before calling Post method:

if StronglyTypedClientDataModule.dtCustomers.Dataset.Modified
then StronglyTypedClientDataModule.dtCustomers.Post
else StronglyTypedClientDataModule.dtCustomers.Cancel;

Best regards

smacks head of course, I completely forgot about the direct .dataset access.

Thanks, that should do the job nicely :slight_smile: