Shouldn't onRecordUpdate trigger on record selection?

Hi

I have the problem, that edited records are not written to the database when a new record is selected. I did hook the table event ‘onRecordUdate’. When I edit a record, I thought the event will trigger, whenever I select an other record. But it looks as if edited records are collected (auto commit is on) and written to the db when I click to the forms background or load an other foundset.

onRecordUpdate I’d like to check a selected school year, raise a dialog and let the user conform the changes or not. When the user now changes e.g. 5 records, this dialog does not show after editing one record but after all 5 edits. And the user gets 5 dialogs which ask him to confirm changes he made some minutes ago.

Is this intended behaviour? Do I misunderstand the event?

Of course I can do the check on the form. But then I have to do it on all forms who edit attributes of this table. I thought a table event is the one and only place for the check.

Thanks for any help

hi Birgit, this works as expected, the trigger will happen when the data is REALLY saved into the database.
not if you go to another record (like in a table-view) as far as I know, the data will be saved when:

  1. you click on a form (on empty space)
  2. when you navigate away to another form.

what you could do, is just this: create an onRecordSelection event, with: databaseManager.saveData()
than if you have a onRecordSelection, the update trigger will fire also

Thank you, Harjo, for your response.

So, as far as I understand, there is no way to work only with onRecordUpdate. If I have to use onRecordSelection (or onRecordEditStop maybe also) I’m back on the form side which I tried to avoid.

Why is this the way it is? I use the table event onRecordDelete which works just fine. It is triggered whenever the user tries to delete a record. And by returning false I prohibit the deletion. With onRecordUpdate this is not possible, since edited records are collected and saved at the moments you described. What is the advantage of collecting edited record? Can I prevent this?

Kind regards

birgit:
What is the advantage of collecting edited record? Can I prevent this?

Well there is certainly an advantage in the number of hits to the database, I suppose that Servoy builds a bulk insert/update or does it all in one go.
What is true is that this should be an optional behavior, in any case something that you should be able to configure, otherwise I agree that there is little sense in onRecordUpdate if you want to use it for confirmation.

Thank you, Patrick, for your answer.

I’m glad to hear that you say, it does not make sense this onRecordUpdate for confirmation purpose. So I did use it correctly. It is just not the appropriate solution for my intention.

So, I have to go to the forms side :(

Regards