Delete multiple keys
Function and purpose of the operation¶
The Delete Multiple Keys operationallows rows in the target dataset to be deleted based on the user-defined keys.
On the operation definition page, it is possible to specify an SQL sort criterion according to which only the first row among the duplicates will be retained.
It is also possible to insert references to fields in the target dataset combined via SQL formulas and to use AW parameters (see AW Parameters page).
Note: The criterion can be omitted. In this case, the system will use as the sorting criterion the list of all fields in the target dataset, in the order in which they were defined, and in ascending order.
In order to define the keys to be taken into account for finding duplicate rows, it is necessary to access the Key Fields link.
Note: Key fields are not mandatory. If not defined, all user fields in the target dataset will be considered as keys.
Example 1: no key field defined and no sort criteria specified
Target Dataset¶
| PRODUCT | PRICE | VALUE |
|---|---|---|
| Prod 01 | 3 | 15 |
| Prod 01 | 3 | 15 |
| Prod 02 | 5 | 20 |
After the execution of the Delete Multiple Keys operation, the resulting dataset will be as follows:
Target Dataset¶
| PRODUCT | PRICE | VALUE |
|---|---|---|
| Prod 01 | 3 | 15 |
| Prod 02 | 5 | 20 |
Example 2: a defined key field and specified sort criterion
Target Dataset¶
| PRODUCT | PRICE | VALUE |
|---|---|---|
| Prod 01 | 3 | 15 |
| Prod 01 | 4 | 21 |
| Prod 02 | 5 | 20 |
The following sorting criterion has been specified on the operations page:PRICE desc
On the Key Fields page, the PRODUCT field was specified as the key.
Duplicate rows will then be selected according to the values in the PRODUCT field and sorted according to the values in the PRICE field in descending order.
After the execution of the Delete Multiple Keys operation, the resulting dataset will be as follows:
Target Dataset¶
| PRODUCT | PRICE | VALUE |
|---|---|---|
| Prod 01 | 4 | 21 |
| Prod 02 | 5 | 20 |