# Rule Conditions

You can seamlessly build rule conditions using the no-code Rule editor over Nected.&#x20;

Conditions would have 3 components:

1. [Property](#property)
2. [Operators](#operators)
3. [Values](#values)

## 1. Property

Click on `property`dropdown to select the properties.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdpOoseGvfBMWCZnHLB0zpHdH8CdahGJUcM6s--r6Mn0bI_Y7w5rbrQ9kShdfxNzZ5BdNjVQYu2leQ3DaeQ7UZPTqX2uTMOXsH3QGqrtjZCAYgInU1f43eePhzeF0dzRQTa_2YoLYZSZ4l__Wz7dng2t1c?key=Fe2gulr_XDvZJGvA0pA-sg" alt=""><figcaption></figcaption></figure>

Nected support below attributes to be selected as property:

### 1. Custom Function

At Nected, we believe that systems should be configurable & flexible to adapt to any business need without a need to do anything from outside.&#x20;

Hence, we have provided a [Javascript (JS) editor](https://docs.nected.ai/nected-docs/code-and-database-queries/javascript-editor) to support any custom and specific condition(s) needed by your business and can't be built in a no-code editor. You can write any Javascript code using input attributes, global attributes, system attributes as well as dataset attributes as [tokens](https://docs.nected.ai/nected-docs/references/pre-configured-tokens).

**Sample JS Formula:**

```typescript
{{.customInput.attributeName}} > {{.dataSet.attributeName}}
```

{% hint style="warning" %}
Custom Function in conditions should return a boolean only otherwise it will throw a **"syntax error"** issue in the editor & will block the rule to get tested.
{% endhint %}

### 2. Input Attributes

These are input attributes defined in [Add Source](https://docs.nected.ai/nected-docs/rules/input-source) and are passed as params in each Rule API. These can be referred to in any editor using token name starting with `.customInput`

### 3. Global Attributes

These are attributes defined under [Global Variables](https://docs.nected.ai/nected-docs/references/global-variables) and can be usable across multiple rules. These can be referred to in any editor using token name starting with `.globalVar`

### 4. System Attributes

System attributes are provided by the system and are related to time and other system-related information.

### 5. DataSet Attributes

These are attributes imported from [Dataset](https://docs.nected.ai/nected-docs/integrations/overview) columns. The type of columns too are derived from the database query directly. If you've selected a dataset as the source, you can use attributes from the dataset to form conditions within the rule. This allows you to leverage the data in your dataset for decision-making.  These can be referred to in any editor using token name starting with `.dataset`

## 2. Operators

Nected provides various pre-configured operators that you can use with SimpleRules and DecisionTables.

<figure><img src="https://4290782554-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLg716fCfV8IUwXQygkTG%2Fuploads%2FIpB2jXG4P9JkUiShGn5X%2Foperator_screenshot.png?alt=media&#x26;token=06078e85-f7d6-43c7-8dc4-8ee959d77f1e" alt=""><figcaption></figcaption></figure>

The following table lists all the pre-configured operators and their available values.

<table><thead><tr><th width="305">DataType</th><th>Available Operators</th><th>Desc</th></tr></thead><tbody><tr><td>Common/Generic</td><td><ol><li>Any</li><li>Exists</li><li>Doesn’t Exist</li><li>Is Null</li><li>Is not Null</li></ol></td><td></td></tr><tr><td>Number</td><td><p></p><ol><li>Between</li><li>Not Between</li><li>Equals</li><li>Not Equals</li><li>Greater than</li><li>Less than</li><li>Greater than or equals</li><li>Less than or equals</li><li>Is Even</li><li>Is Odd</li></ol></td><td></td></tr><tr><td>String</td><td><ol><li>Equals</li><li>Not Equals</li><li>Contains</li><li>Does not Contains</li><li>Starts With</li><li>Does not start with</li><li>Ends with</li><li>Doesn’t Ends with</li><li>Is IN</li><li>IS NOT IN</li><li>Is Empty</li><li>is not Empty</li></ol></td><td></td></tr><tr><td>Dates or DateTime</td><td><ol><li>Between</li><li>Not Between</li><li>Equals</li><li>Not Equals</li><li>Greater than</li><li>Less than</li><li>Greater than or equals</li><li>Less than or equals</li></ol></td><td></td></tr><tr><td>Boolean</td><td><ol><li>Is False</li><li>Is True</li></ol></td><td></td></tr><tr><td>List</td><td><p>Contains</p><p>Does not Contain</p><p>Is Empty</p><p>Is not Empty</p></td><td><p>Checks if the list contains a specific value.</p><p>Checks if the list does not contain a value.</p><p>Checks if the list is empty.</p><p>Checks if the list is not empty.</p></td></tr><tr><td>JSON</td><td><p>Has Key</p><p>Does not Have Key</p><p>Contains</p><p>Does not Contain</p></td><td><p>Checks if the JSON object contains a specific key.</p><p>Checks if the JSON object does not contain a specific key.</p><p>Checks if the JSON contains a specific value or key-value pair.</p><p>Checks if the JSON does not contain a specific value or key-value pair.</p></td></tr></tbody></table>

## 3. Values

Values can mostly be constants or [tokens](https://docs.nected.ai/nected-docs/references/pre-configured-tokens) of the same datatype as property.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcSOYYIBLuLDIDccTSiAm67ji3-dcLn41Xl4qn5yySBQfxnljazv873_2_g4Nx9z1_J2jYpiS6wIy9veemTiWXSQofJKDisXpaHIRRsunr_mmrZzhukO_NJSrho4vWJ3CWeiOQtnL_pDfjZg4kuGt3ekFs?key=Fe2gulr_XDvZJGvA0pA-sg" alt=""><figcaption></figcaption></figure>

## Error Handling

In case of any issue in the condition, the Rule will show an error like mentioned below, and the Testing rule in staging will not be allowed till you fix the error. And since we don't allow rules to be published if not tested, publishing rules too would be blocked. This is to ensure that nothing wrong or bad goes into your production anyhow.
