Uniqueness check

This data rule definition logic checks for unique data values. It can be used to confirm that you do not have duplicate data values.

Syntax

Positive:

source-data UNIQUE

Negative:

source-data NOT UNIQUE 

Description

When positive, the uniqueness check finds rows for which the source data value occurs exactly once in the table. When negative, it finds rows for which the source data value occurs more than once in the table.

Notes

  • No reference data is necessary for this type of data rule definition logic. If reference data is present, it is ignored.
  • This type of checks implies the computation of aggregations on the source columns. These operations can take much longer to execute than other types of checks which only have to test single records.

Use case scenario

You work for a chocolate bar retailer, and you want to make sure that all the product codes that you have assigned to each type of chocolate bar are unique. You want to create a data rule to verify that all the product codes in the master catalog table are unique. If there are duplicate product codes, this rule definition will alert you to errors that need to be fixed.

The rule definition that you name, "Unique product codes for chocolate bars," will report the number of unique product codes in the master catalog table. Build your data rule definition logic as follows:
  • Source Data: Master_Catalog_Product_Code
  • Type of Check: unique
When you are done, the data rule definition looks like this example:
Master_Catalog_Product_Code unique 

Next, generate a data rule out of the data rule definition. Click the Bindings and Output tab.

On the Bindings and Output tab, bind your rule definition components to real data in your data sources:

  • Name: MSTRCTLG_PRODCODE
    • In the rule definition, the logical representation for the MSTRCTLG_PRODCODE was written as "Master_Catalog_Product_Code," but now you need to find the actual MSTRCTLG_PRODCODE column in your table. Find the table and then the column that contains rows that contain the master catalog product code. Highlight the column and click Set as Binding.

For this example, you do not need to perform any joins. You can select the output that you want to see on the Output tab.