register
SqlDuplicateFilter SqlDuplicateFilter.register ( String table, SqlDataManager dataManager ) (professional and enterprise editions only)
Description
Create an SqlDuplicateFilter for a specific table and register it with the data manager.
Parameters
- table Name of the database table with the primary key, as a string.
- dataManager The data manager that will use this filter when adding entries to the database.
Return Values
Returns an SqlDuplicateFilter that can then be configured for duplicate entries.
Change Log
Version | Description |
---|---|
5.0 | Available for professional and enterprise editions. |
Examples
Register a new duplicate filter
// Import classes
import com.screenscraper.datamanager.sql.*;
//Get the data manager
SqlDataManager dm = session.getVariable( "_DATAMANAGER" );
// Register a new duplicate filter
// Check for duplicate people, so register it for the people table
SqlDuplicateFilter nameFilter = SqlDuplicateFilter.register("people", dm);
//Add constraints to match when a first name, middle initial, and last name match a different row in the database
nameFilter.addConstraint( "people", "first_name" );
nameFilter.addConstraint( "people", "middle_initial" );
nameFilter.addConstraint( "people", "last_name" );
import com.screenscraper.datamanager.sql.*;
//Get the data manager
SqlDataManager dm = session.getVariable( "_DATAMANAGER" );
// Register a new duplicate filter
// Check for duplicate people, so register it for the people table
SqlDuplicateFilter nameFilter = SqlDuplicateFilter.register("people", dm);
//Add constraints to match when a first name, middle initial, and last name match a different row in the database
nameFilter.addConstraint( "people", "first_name" );
nameFilter.addConstraint( "people", "middle_initial" );
nameFilter.addConstraint( "people", "last_name" );
Match Duplicates across tables
// Import classes
import com.screenscraper.datamanager.sql.*;
//Get the data manager
SqlDataManager dm = session.getVariable( "_DATAMANAGER" );
// Register a new duplicate filter
// Check for duplicate people, so register it for the people table
SqlDuplicateFilter personFilter = SqlDuplicateFilter.register("people", dm);
// Catch duplicates when a new entry has the same first name, last name, and phone number as another entry
// Note that phone is a child table of people
personFilter.addConstraint( "people", "first_name" );
personFilter.addConstraint( "people", "last_name" );
personFilter.addConstraint( "phone", "phone_number" );
import com.screenscraper.datamanager.sql.*;
//Get the data manager
SqlDataManager dm = session.getVariable( "_DATAMANAGER" );
// Register a new duplicate filter
// Check for duplicate people, so register it for the people table
SqlDuplicateFilter personFilter = SqlDuplicateFilter.register("people", dm);
// Catch duplicates when a new entry has the same first name, last name, and phone number as another entry
// Note that phone is a child table of people
personFilter.addConstraint( "people", "first_name" );
personFilter.addConstraint( "people", "last_name" );
personFilter.addConstraint( "phone", "phone_number" );
mikes on 04/14/2011 at 1:48 pm
- Printer-friendly version
- Login or register to post comments