table.DELETE_DUPS Function

Syntax

V Delete_Dups(C Dup_Key_Expression,C Filter_Expression)

Arguments

Dup_Key_Expression

A character filter expression that evaluates to a logical value. A field or a combination of fields that Alpha Anywhere uses to determine which records in the table are considered duplicates.

Filter_Expression

Optional. Default = ".T." (all records). A character filter expression that evaluates to a logical value. Only records that satisfy the filter are checked for duplicates. If no Filter (a logical ) is specified, then all records are checked for duplicates.

Description

Deletes the duplicate records in the table.

Discussion

The <TBL>.DELETE_DUPS() method is a high-level utility method you use to delete duplicate records in a table. A Duplicate_Key_Expression is a field or a combination of fields that Alpha Anywhere uses to determine which records in the table are considered duplicates. For example, if you consider a record with the same values in the Firstname, Lastname and Address1 fields to be a duplicate, the Duplicate Key Expression would be: Firstname + Lastname + Address1. In order to delete a subset of duplicate records, you can add a Filter to the script. Only records that satisfy the filter are checked for duplicates. If no Filter is specified, then all records are checked for duplicates, regardless of any query that might currently be applied to <TBL>.

Example 

This script deletes all records in the current table that have the same PROD_ID field.

tbl = table.current()
tbl.delete_dups("PROD_ID")

This script deletes all records with PRICE > 100 in the current table that have the same PROD_ID field.

tbl = table.current()
tbl.delete_dups("PROD_ID","PRICE > 100")

See Also