function beforeProcessDeltaChange(delta, change, wasRefreshed, canRemove)
{
if (!change.isDelete && !change.newValues['name']) {
fail('Name is required');
}
if (!change.isDelete ) {
change.newValues['modified'] = new Date().toString();
}
if (change.isInsert) {
change.newValues['created'] = new Date().toString();
}
}
Can I catch exceptions (fail function) on the client side (Delphi) to show my error dialog and have some custom code?
Is there a better way to do validation on the server side?
You can drop the Business Processor component to service in design-time and set handler via Object Inspector or assign handler in the DataAbstractService.OnBusinessProcessorAutoCreated event in run-time like
procedure TDataService.DataAbstractServiceBusinessProcessorAutoCreated(
aSender: TRORemoteDataModule; BusinessProcessor: TDABusinessProcessor);
begin
if BusinessProcessor.ReferencedDataset = 'mytable' then
BusinessProcessor.OnProcessError := MyProcessError;
end;