# If Condition

### Introduction

The "If Condition" action in DBSync Cloud Workflow allows you to implement conditional logic within your workflows. This feature enables you to execute different actions based on specific criteria, enhancing the flexibility and functionality of your integrations.

### Prerequisites

* A configured project in DBSync Cloud Workflow.
* At least one flow created where you want to implement the "If Condition."

### How to Configure the If Condition

1. In the Flow screen, drag the Flow Icon from the Actions palette on the left and drop it in the center of the screen.
2. Click **Configure** on the flow panel to configure the flow.
3. In the **Flow** configuration panel that opens on the right side, enter the required description for the flow and click **Save**.
4. Add other required actions from the left panel to the center of the screen.
5. **Add the If Condition Action:** Once you have added the required actions, drag and drop the 'If Condition' action from the left panel into your flow.
6. Click **Configure** to set up the condition.
7. Define the Condition: In the configuration panel, specify the condition to be evaluated. The conditions may involve checking if:

* a field equals a certain value,
* a number is greater than a specific threshold, or
* any other logical condition based on your workflow requirement.

8. Click **Save** after defining the condition.

### Filter Files by Type or Name

When filtering by file type or file name in the "If Condition":

* In the configuration panel, choose **file\_type** or **source\_file\_name** as the variable for condition evaluation.
* To match patterns instead of exact names or types, use the asterisk (‘\*’) wildcard before or after your filter identifier:
  * Prefix with \* (for example, \*report) to match any filename ending with "report".
  * Suffix with \* (for example, invoice\*) to match any filename starting with "invoice".
  * Use \* on both sides (for example, *data*) to match filenames containing "data" anywhere.

This approach ensures flexible matching and helps filter files even when names or types follow variable patterns.

#### Example Scenarios

* Suffix Matching (for example, invoice\*)\
  To trigger logic for monthly invoice files such as "invoice\_Jan.pdf", "invoice\_Feb.pdf", or "invoice\_2025.xlsx", use invoice\* with the source\_file\_name variable to capture all of them.
* Prefix Matching (for example, \*report)\
  If your team exports reports with names like "sales\_report.csv", "inventory\_report.csv", or "customer\_report.xlsx", use \*report with the source\_file\_name variable to run actions whenever a file ends with "report".
* Contains Matching (for example, *data*)\
  For files like "customer\_data\_backup.zip", "data\_summary.txt", or "bigdata\_metrics.csv", set the condition to \*dat&#x61;*\** with the source\_file\_name variable to trigger actions on all files containing "*data*" anywhere in their name.

### Configure True / False Outcomes and Run

{% stepper %}
{% step %}
**Add Actions for True and False Outcomes:** Define actions for both *True* and *False* outcomes below the condition.

* Drag and drop the desired actions (for example, sending an email, updating a record, or executing another flow) into the respective sections based on the expected outcome of the condition.
  {% endstep %}

{% step %}
**Save the Flow:** After configuring the **If Condition** and adding the necessary actions, click **Save** to save your flow.
{% endstep %}

{% step %}
**Run the Integration:** Click **Run** <img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2Fib01L91gPyxqU8v8IEBP%2Funknown.png?alt=media&#x26;token=c5328b25-05fe-4e00-be01-8b4ba8084ec1" alt="" data-size="line"> to execute the flow.&#x20;

Monitor the console output to verify that the **If Condition** is evaluated correctly and that the appropriate actions are executed based on the condition.
{% endstep %}

{% step %}
**Debugging:** If needed, add a **Debug** action before the **If Condition** to inspect the values being evaluated.

This helps ensure that the condition is set up correctly.
{% endstep %}

{% step %}
**Review Results:** After running the integration, check the console output for any errors or confirmation messages.

This will help you understand if the **If Condition** worked as intended.
{% endstep %}

{% step %}
**Iterate and Optimize:** Based on the results and any issues encountered, make necessary adjustments to the condition or actions.

Repeat the testing process until the workflow operates as expected.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
PRO TIP: Use nested "If Conditions" to build complex decision-making logic within your workflows. This allows for granular control over the actions executed based on multiple criteria.&#x20;

* Always use the asterisk ‘\*’ as indicated to cover partial matches.&#x20;
* Combine multiple conditions (such as `file_type AND source_file_name`) for granular control.&#x20;
* Use the **Debug** action to inspect the evaluated values and ensure correct filter setup.
  {% endhint %}

### FAQ

<details>

<summary>Can I use multiple conditions in a single "If Condition" block?</summary>

Yes, you can combine multiple conditions within a single "If Condition" block using logical operators like AND and OR to create more complex logic for your workflows.

</details>

<details>

<summary>What types of operations can I perform based on an "If Condition"?</summary>

You can perform various operations, such as executing different actions, triggering workflows, or modifying data based on the evaluated conditions.

</details>

<details>

<summary>Is it possible to trigger notifications or alerts based on "If Conditions"?</summary>

Yes, you can set up notifications or alerts by configuring actions like sending emails based on the outcomes of "If Conditions."

</details>

<details>

<summary>What applications or data sources can I use with "If Conditions"?</summary>

"If Conditions" can be used with any supported data sources or applications integrated within DBSync Cloud Workflow, including Salesforce, databases, and other connectors.

</details>

<details>

<summary>Can I use wildcards to filter files by name or type?</summary>

Yes, by including \* before or after the filter identifier with file\_type or source\_file\_name in your condition.

</details>

<details>

<summary>Does this work for all integrated storage sources?</summary>

File filtering by file\_type and source\_file\_name works on all supported storage connectors in DBSync Cloud Workflow.

</details>

### Related Content

* [Query](https://docs.mydbsync.com/cloud-workflow/ipaas/functional-concepts/query): In DBSync cloud workflow, you can easily add and configure queries to fetch data from multiple sources. This functionality allows you to customize search parameters and obtain specific results tailored to your business needs.
* [Debug](https://docs.google.com/document/d/14MCRfISd6NI_tM7yAUu_ci-mz_Y8PzE_Zffq8f4tjDI/edit#heading=h.q8inv0iuih8v): Learn how to effectively use the Debug action to troubleshoot and validate your workflows.
* [Logs](https://docs.mydbsync.com/cloud-workflow/dbsync-platform/administration/logs): Troubleshooting common errors in DBSync cloud workflow.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydbsync.com/cloud-workflow/2026_create-your-workflow/action/conditions/if-condition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
