dc_cancel tabpanel tab relation record deleted

I have a form “1” based on table “A” and on that form “1” a tabpanel. In the tabpanel tab I have a form “2” based on table “B”. The tab uses a relation “A_to_B”. On form “1” I have two buttons one for creating and one for deleting records on form “2” in table “B”. If I use the delete button, the record in table “B” is deleted immediately.

The problem is, if “dc_cancel” is called, the record is lost. Is this a (known) bug?

when is dc_cancel called? When you are creating the record? dc_cancel will revert the creation of the record and the record is lost, when you are editing a record you should only lose the edited data. So it depends on the Mode of your form what dc_cancel will do with your record.

jdbruijn:
when is dc_cancel called? When you are creating the record?

Hello Jos, in the situation when I go to edit mode through “dc_edit” and there are records saved before to table “A” and table “B”. The records in table “B” are created through the relation.

jdbruijn:
dc_cancel will revert the creation of the record and the record is lost, when you are editing a record you should only lose the edited data. So it depends on the Mode of your form what dc_cancel will do with your record.

Why the record is lost, if I called “dc_edit” with existing data, deleted (accidentally) a relational record in table “B” and then call “dc_cancel”?

So you are in edit mode in the main table. While doing this a related record is deleted. And you want to know why it is not restored when you cancel the edit mode on the main table?
Deleting records is immediate and cannot be reverted as far as I know. A work around is to not delete the related records, but to add a IsDeleted field to this table and use this flag in a table filter param. I think that in this case the cancel will remove the IsDeleted flag and the record is again available.

jdbruijn:
So you are in edit mode in the main table. While doing this a related record is deleted. And you want to know why it is not restored when you cancel the edit mode on the main table?

Yes, Im in edit mode in the main form. Yes, why is the related deleted record not restored, if “dc_cancel” is called?

jdbruijn:
Deleting records is immediate and cannot be reverted as far as I know.

But in this case, it’s a bug or not?

deezzub:
But in this case, it’s a bug or not?

This is by design.