# Validating data using tDQRules

The Job in this scenario uses the tDQRules component to validate data using a [validation rule](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/DataProducts/Working-with-validation-rules.htm) from Qlik Talend Data Integration. This component is available from Talend Studio 8.0 R2025-06.

The Job uses the following rule: ![Configuration of the validation rule.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/tdqrules-rule-conf.png)

## Setting up the Job

### Procedure

1. Drop the following components from the **Palette** onto the design workspace: tFixedFlowInput, tDQRules, and three tLogRow components.
2. Using a Main link, connect tFixedFlowInput to tDQRules
3. Using the Flow link, connect tDQRules to a tLogRow.
4. Using the Not\_Applicable link, connect tDQRules to another tLogRow.
5. Using the Reject link, connect tDQRules to the last tLogRow.

   ![A 5-component Job to validate data using the tDQRules component.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/tdqrules-job.png)

## Configuring the tFixedFlowInput component

### Procedure

1. Double-click tFixedFlowInput to open its Basic settings view.
2. Select Built-In as Schema and click […] next to Edit schema.
3. To add columns, click ![Add icon](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/add.svg) and click OK.

   ![Schema of the tFixedFlowInput component.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/tdqrules-donation-input.png)
4. Select Use Inline Content (delimited file).
5. Enter your data. In this example:
   ```
   Mendoza,Patricia,39,true,44,AB-,Nantes,44000
   Larsen,Sheri,37,true,10,B+,Rennes,35000
   Dupont,Megan,95,false,27,O+,Marseille,13000
   Oconnor,Emily,78,false,50,A-,Nice,06000
   Plisson,Joseph,60,true,5,O-,Perpignan,66000
   Clark,Kirsten,18,true,0,B+,Angers,49000
   Lapointe,Jason,40,true,2,A+,Paris,75100
   Park,Traci,28,true,28,B-,Nantes,14000
   Rodriguez,Glenn,55,false,29,B+,Rouen,76000
   ```

## Configuring the tDQRules component

### Before you begin

* You have created at least one [validation rule](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/DataProducts/Working-with-validation-rules.htm) in Qlik Talend Data Integration.
* You have generated an API key. For more information, see [Generating an API key](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Admin/mc-generate-api-keys.htm).

### About this task

To retrieve the rules, you need:

* The access to the space in which the rule is stored.
* The Rules - View permission.

### Procedure

1. Select Built-in as Property Type and Schema.
2. To retrieve the schema from the input component, click Sync columns.
3. Enter the URL to Qlik Talend Data Integration. For example: http://qcs.us.qlikcloud.com/.
4. To enter your API key, click [...].
5. To retrieve the rule, click Fetch rules. The Rule library timestamp field is filled in.

   When you click Fetch rules, a JAR file containing the rule definition is created in:
   ```
   studio-path\configuration\.m2\repository\org\talend\libraries\rule-number
   ```

   When you update the rule in Qlik Talend Data Integration, click Fetch rules to retrieve the latest version.
6. To select the rule, click [...] next to Rule name.

   When no rules or input columns are available, verify that:
   * The rules have been retrieved in Rule library timestamp.
   * The input schema is correct.
7. Select the rule and click OK to close the window. You can select one rule only.
8. Click Refresh table.
9. Associate the rules variables to the input columns.

   ![Configuration window to associate the variables.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/tdqrules-config-variables.png)

   You can associate the data types from Talend Studio with some data types from Qlik Talend Data Integration. For more information, see [The operators](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/DataProducts/Working-with-validation-rules.htm#anchor-10) available in Qlik Talend Data Integration.

## Configuring the tLogRow components

### Procedure

1. Double-click the tLogRow components to open their Basic settings view.
2. Select Built-in as Schema and click Sync columns.
3. In the Mode area, select Table (print values in cells of a table).

   ![Configuration of the tLogRow components.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/tLogRow_BasicSettings.png)

## Saving and executing the Job

### Procedure

Press **F6** to save and execute the Job.

### Results

The tLogRow from the Flow link returns the givers whose blood group is available and ends with + or -, and who are 18 up to 70 years old.

```
|=-------+---------+---+-----+-----------+----------+---------+---------=|
|Name    |FirstName|Age|Giver|NbrDonation|BloodGroup|City     |PostalCode|
|=-------+---------+---+-----+-----------+----------+---------+---------=|
|Mendoza |Patricia |39 |true |44         |AB-       |Nantes   |44000     |
|Larsen  |Sheri    |37 |true |10         |B+        |Rennes   |35000     |
|Plisson |Joseph   |60 |true |5          |O-        |Perpignan|66000     |
|Clark   |Kirsten  |18 |true |0          |B+        |Angers   |49000     |
|Lapointe|Jason    |40 |true |2          |A+        |Paris    |75100     |
|Park    |Traci    |28 |true |28         |B-        |Nantes   |14000     |
```

The tLogRow from the Not\_Applicable link returns the givers whose data cannot be validated by the condition requirement. For example: The blood group does not end with + or -, or the givers are too young or too old.

```
|=------+---------+---+-----+-----------+----------+---------+---------=|
|Name   |FirstName|Age|Giver|NbrDonation|BloodGroup|City     |PostalCode|
|=------+---------+---+-----+-----------+----------+---------+---------=|
|Doe    |John     |25 |true |44         |O         |Grenoble |68000     |
|Dupont |Megan    |95 |false|27         |O+        |Marseille|13000     |
|Oconnor|Emily    |16 |false|50         |A-        |Nice     |6000      |
```

The tLogRow from the Reject link returns the givers who should be marked as givers (true) because they fulfilled each condition requirement but they are marked as false.

```
|=--------+---------+---+-----+-----------+----------+-----+----------+-----------------------------------------------------------------------------------------------------------------------------------------------=|
|Name     |FirstName|Age|Giver|NbrDonation|BloodGroup|City |PostalCode|INVALID_STATUS                                                                                                                                  |
|=--------+---------+---+-----+-----------+----------+-----+----------+-----------------------------------------------------------------------------------------------------------------------------------------------=|
|Rodriguez|Glenn    |55 |false|29         |B+        |Rouen|76000     |[{"FieldNames":["Name","FirstName","Age","Giver","NbrDonation","BloodGroup","City","PostalCode"],"ruleName":"BloodDonation","status":"INVALID"}]   
```