Deleting records

Hello All,

I have a problem regarding deletion of the records.

If any user tries to delete a record from the form ,it should not be displayed in or should be removed from the form but it should reside in the table used against that form.

How can i achieve this ?

Also same issue when user tries to select and delete multiple records .

Its urgent please.

Is that specific to user or for all users?

So how would you say that a record shouldn’t be displayed in the form? Obviously, you will need a filter - the form will show only records not marked as deleted. So you need to set this flag instead of deleting the record.

And if you want, you can do it in datatasource’s delete() method. Set the flag, update the record, don’t call super() and update the records displayed.

Hello Martin ,

could you be more specific about the solution and which method would be more useful delete() or validatedelete() ?

The implementation could look somehow like this (showing methods of the datasource):

public void init()
{
    super();
    this.queryBuildDataSource().addRange(fieldNum(Table1, Deleted)).value(queryValue(NoYes::No));
}

public void delete()
{
    Table1.Deleted = true;
    Table1.update();
    this.research();
}

validateDelete() has still the same purpose as before - it says whether a record may be deleted. We just changed what “to delete” means for this table.