Editing Records with Virtual Widgets

Using the function dal_wdh_wri_lis you can write records in the data base, which were edited (update operation) or newly inserted (insert operation) in DataView. DataView realizes for each records with the help of the content of the internal record ident number, which kind of operation you execute for the data base table.

If - because of wrong entries or transaction problems - it is not possible to write a record into the data base, the record-dirty-flag remains set after returning from the function dal_wdh_wri_lis (drt = m). In case of success the record-dirty-flag will be automatically reset by DataView (drt = 0). Using the function dal_mas_ret_drt_rec you can enquire the record-dirty-flag for each record.

Program the following sequence to write edited or newly inserted records into 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. If required, execute the edit_action-userexit of the mask for update mode via the function dal_mas_upd_row.

  6. Edit the mask data using the available standard functions.

    For instance you could write a field entry with dal_mas_wri_fld.

  7. Set the record-dirty-flags for all changed record with the functions dal_mas_set_drt_rec to drt = m and the field-dirty-flags for all changed fields with the function dal_mas_set_drt_fld to drt = m.

    The field-dirty-flag must be set only once for each field, irrespective of whether you changed the field contents of one or several records in the column record buffer of the field.

  8. Write all changed records of the mask into the data base with the function dal_wdh_wri_lis.

  9. Check whether DataView successfully wrote all records into the data base. To do so, evaluate the return code of the function dal_wdh_wri_lis or inspect the record-dirty-flags with the function dal_mas_ret_drt_rec.

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