Deletes the record in the base table associated with the group where the Delete command is specified.
Syntax
Delete
Description
This command is used to delete records in the
Base Table associated with the group where the
Delete command itself is specified.
A Delete command can only be used in a
For Each command. The deletion is executed at the exact moment the Delete command is encountered, unless the For each command has a
Blocking clause. In this last case, the actual deletion will happen when the entire block is completed and a Delete command is sent to the DBMS for a bulk deletion.
Notes
-
Referential Integrity - this is NOT automatically checked when the Delete command is specified.
-
If the Delete command is specified in a group that has nested groups, data in the current group can be used in the inner nested groups, even though it has been physically deleted.
-
Remember to delete the inner levels first, before the outer levels. This avoids any possible cancellations or locks.
Example
Given the tables:
PurchaseOrder
PurchaseOrderId*
PurchaseOrderDate
SupplierId
PurchaseOrderAmount
PurchaseOrderDetail
PurchaseOrderId*
PurchaseOrderDetailId*
PurchaseOrderDetailQuantity
PurchaseOrderDetailPrice
PurchaseOrderDetailAmount
Here, purchase order lines are deleted before the purchase order header, so if the program were to cancel, there would be no purchase order lines left without a header.
For each //Header
where PurchaseOrderDate <= &LimitDate
For each
Defined by PurchaseOrderDetailPrice
Delete
Endfor
Delete
EndFor
Scope