Deleting Records with Virtual Widgets

With the function dal_wdh_del_lis you can delete records in virtual widgets. The function uses DataView in an identical way for interactive deleting, too. That is why you do not have to explicitly program any checks on access privileges, locks, and reference elements. DataView automatically performs these checks when you use the function. This function is a decisive security factor for sensitive delete operations.

If you executed dal_wdh_del_lis, the deleted records are in the trash-basket widget, as it is also true for interactive mode. With dal_wdh_rol_tra you can undo the temporary delete process for individual records. To finally delete the records in the trash-basket widget the function dal_wdh_del_tra is available.

If records in the data base cannot be temporarily deleted because of missing access privileges, locks or reference checks, the record remains unchanged with all related elements in the data structure of the widget.

Program the following sequence to delete records in the data base:

  1. Set the widget virtual mode with the function dal_wdg_set_vir (flg = 1).

  2. Create the widget. For an entity widget, for instance, you would use the function dal_iwf_lis_ent.

    In case of relations widgets you should always specify the full name of the relation (entity-1, entity-2 and view) and then define the parent element of the relation with the function dal_wdg_set_ide.

  3. If required, enter search terms into the query buffer of the relevant mask fields with the function dal_mas_wri_sel.

  4. Execute a data query with the function dal_wdh_upd_lis.

  5. Set the record-dirty-flags for all records to be deleted with the function dal_mas_set_drt_rec to drt = +.

    Thus you selected the records to be deleted.

  6. Delete all selected records of the mask with the function dal_wdh_del_lis.

  7. Check whether DataView successfully deleted all records. (loop, checking all remaining records in the widget).

  8. Call the function dal_wdh_del_tra if records have to be finally deleted from the data base.

    Attention! This function finally deletes all records including any previously existing records in the trash-basket.

  9. Delete the virtual widget with dal_wdg_del_wdg and deactivate the widget virtual mode with dal_wdg_set_vir (flg = 0).