Conditional Constraints
Create conditional constraints to restrict the data that you want to generate in a column based on the data in another column. The conditional constraint that you enter becomes a part of the metadata of the target table.
Configure expressions to apply constraints at the table level. Use the Expression Builder to enter the expressions. You can create multiple conditional constraints for a table.
You cannot use conditional constraints for the following data generation techniques:
- •Numeric sequence
- •Date sequence
- •Random data patterns
Conditional Constraints Example
You have a table that contains airline ticket information and you want to generate airport codes in From_City and To_City columns in the table. You create and assign a dictionary generation rule to the columns. You do not want the From_City column and the To_City column to have the same value in a row. You create a conditional constraint and enter the following expression in the Expression Builder:
To_City != From_City
When you perform the data generation operation, TDM adheres to the conditional constraint and generates data in the From_City and To_City columns.
The following table lists sample flight details with generated data:
Flight Code | From_City | To_City |
---|
11A1 | BOS | SFO |
22B2 | AUS | EWR |
33C3 | SEA | JFK |
Conditional Constraints and Data Conflicts
When you perform a data generation operation, there might be conflicts between the conditional constraint and the values specified in the data generation rule parameters. The data generation operation prioritizes the data generation rule over the conditional constraint and TDM generates data with warning messages.
Conditional Constraints and Data Conflicts Example
You want to generate data in the Created_Date and Modified_Date columns in an Employee table. You create a random generation rule with a date range from January 1, 1970 to July 31, 2014, and assign the rule to both Created_Date and Modified_Date columns. You want the value in the Modified_Date column to be greater than the value in the Created_Date column. You create a conditional constraint and enter the following expression in the Expression Builder:
Modified_Date > Created_Date
When the Created_Date column contains July 31, 2014, TDM cannot generate data that adheres to the conditional constraint because the data generation rule parameters restrict the end dates to July 31, 2014. TDM generates a date within the specified range in the Modified_Date column and generates warning messages.
The following table lists sample employee details with generated data:
Employee ID | Created_Date | Modified_Date |
---|
1111 | 7/31/2014 | 1/13/2002 |
2111 | 6/5/2000 | 5/6/2010 |
8112 | 7/31/2014 | 5/16/1990 |