To validate you data file against values in the database:
- add connection to the Schema (See instructions here);
- double click on the field that you want to use as link to your database;
- right click on the Rules node in the Rule Builder area and select ;
- fill in Custom Query form details and click OK button:
- Connection Name - Select database that you want to link to;
- chose the cardinality type from options: Exist, Not Exesist or RowCount;
- Select From - table/view name or Inner Join Statement;
- Where - conditions in the where clause of the query linked by AND operator;
- Value or Map - defines whether condition will be based on benchmark value or value from the file field which contains the rule.
Example:
Data file contains customer information with ID field as primary key. Orders table in the database has CustomerID field as foreign key to Customers.ID field. It is required that file contains only customers who have orders within the last month.
! Note It is possible to use REGEXP operator with query rules. It works by default with Oracle databases that have inbuilt REGEXP_LIKE operator. However custom REGEXP_LIKE function must be created for SQL Server. See this manual for details.