---
title: "Conditional Masking"
slug: "data-masking-conditional-masking"
updated: 2025-07-31T13:32:57Z
published: 2025-07-31T13:32:57Z
canonical: "knowledge.curiositysoftware.ie/data-masking-conditional-masking"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.curiositysoftware.ie/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional Masking

> Apply flexible and targeted data masking rules to protect sensitive information before it’s shared in less-secure environments. Ensure regulatory compliance and reduce the risk of data breaches by masking specific data based on custom conditions. This guide will walk you through the key features of conditional data masking and how to configure it for your needs.

[Data Masking - Conditional Rules Tutorial | Enterprise Test Data](https://www.youtube.com/embed/sB6ztZnfYdA)

- **Apply Conditional Rules:** Mask data based on specific conditions in your database.
- **Targeted Masking Functions:** Execute masking with custom WHERE clauses for more precision.
- **Flexible and Precise:** Adapt data masking to meet your specific data protection requirements.

To complete this section, you need to have completed ‘Database Masking’

Navigate to the **Rules**tab in the side ribbon and click **Rule Set Explorer.**

Choose the **Masking Rules** tab.

> **Note:**
> 
> Often users don’t realise they are on the wrong tab when searching for **Rules** make sure you are on the right tab

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-LQJOAHN0.png)

Choose the ruleset you need. In this case **Curiosity Bank Mask.**

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-4KP2CVKZ.png)

When you are in the **Masking Rule Set** choose to either expand the existing table ‘**Customers**’ in the below example or ‘**Add Table**’ on the right of the screen.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-TIIFJFJJ.png)

Select a **table**and click Add tables. When you’ve added all tables you need, click **OK**

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-72IL5MDR.png)

The tables will now appear in the **Masking Rule Set**

Choose the table and column you wish to mask. This this case **amount** will be the column we mask conditionally.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-CJO9FNT1.png)

We will now apply the type of mask and it’s rules. In this case a type of **Random** with a Function of **Masking.int**

> [!NOTE]
> The **type**should be the type of masking function you want to use, Random, Dates or Lists for example.
> 
> The **function**should be chosen to match the column details (int, date, string)

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-CWDXB1OE.png)

We then need to apply the conditional logic in the **where** field. This is SQL logic and based on another column name from the table.

```sql
transaction_type = 'Direct Debit'
```

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-GZV3SIZ2.png)

We also chose the **parameters** for the masking function. A min & max value of 5000 & 100000. When complete, click **OK**.

With conditional masking, you can add multiple conditions to the same table. We will now add another. Repeat the above steps but adjust the SQL.

As before, we choose a type of **Random** and a function of **masking.int**with a Where clause applied & smaller parameter values.

```sql
transaction_type = 'ATM' AND transaction_Type != 'Direct Debit'
```

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-FMF66BNI.png)

Click **OK** when ready.

This condition will now apply different masking routines to the same column based on the conditional logic and data stored within the table. You can continue this process until you have added as much logic as you require.

This scenario we now have 2 different types of masking outcomes applied to the column.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-VHMJW0JD.png)

This routine is now ready to run. Click **Run Mask**and choose a server to execute the job on.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-T6L5QJMR.png)

Executing the job starts the masking routine and you can track this directly from the job view.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-PG1MIVXX.png)

You can navigate to the **Job Queue** to via **Self-Service Data → View Jobs**

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-J3GFN7L7.png)

Once completed, a **Run Results** view will show you some metrics of what’s been masked.

![](https://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-94G847JN.png)
