---
title: "Validation and Filter Logic using tables and fields"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5249990817/Validation%20and%20Filter%20Logic%20using%20tables%20and%20fields"
format: markdown
---
Allows to perform comparison operation based on values of certain fields in object. Can be used in [FProperties](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/4350672933) conditional rendering and other places

Record of the object is taken from a Path by Table property definition

### Definition

| **Property** | **Description** | **Value** | **Default** |
| --- | --- | --- | --- |
| **table** | API field name of an object (reachable via path definition from initAt) | ```
"table":"Account"
``` | empty |
| **field** | API name of a field to do matching on a record | ```
"field": "Name"
``` | empty |
| **filter** | Operation types<br>==, eq  → equals<br>!=, ne → not equals<br>< →  less than (for numbers)<br>> → more than (for numbers)  
in  →  element in collection (useful for picklists)  
out → element not in collection | ```
"filter":"=="
"filter":"eq"
"filter":"!="
"filter":"ne"
"filter":"<"
"filter":">"
"filter":"in"
"filter":"out"
``` | empty |
| **value** | String, Boolean or array | ```
"value": 1,
"value": "test",
"value": ["A","B","C"]
``` | empty |
| **default** | When the field's value is null/empty, this property determines what the condition evaluates to. | ```
"value": true
``` | empty |

### Examples

Shows section if record type name field has certain value

```
"condition": [
    {
        "table": "FIELDBUDDY__Installed_Product__c",
        "field": "RecordTypeName__c",
        "filter": "IN",
        "value": [
            "Radio - Hardware",
            "Data - Hardware",
            "Telefonie - Hardware",
            "Telefonie - Data - Hardware",
            "Radio - Data - Hardware"
        ]
    }
],
```

```

{
    "condition": [
        {
            "table": "FIELDBUDDY__Installed_Product__c",
            "field": "Component_TypeID__c",
            "filter": "in",
            "value": [
                  "3","18","54","55","56","58","59","60"
            ]
        }
    ],
    "mapping": "FIELDBUDDY__Installed_Product__c",
    "objects": [
      {
        "name": "Manufacturer__c"
      }
    ],
    "title": "Manufacturer",
    "table": "FIELDBUDDY__Installed_Product__c"
}
```

```
{
    "condition": [
        {
            "table": "FIELDBUDDY__Work_Order__c",
            "field": "FIELDBUDDY__Type__c",
            "filter": "in",
            "value": [
                  "INSPECTION"
            ]
        }
    ],
    "headless": true,
    "iconName": "md-briefcase",
    "iosIconName": "ios-briefcase",
    "mapping": "FIELDBUDDY__Work_Order__c",
    "title": "${FIELDBUDDY__Work_Order__c.label}",
    "objects": [
        {
            "name": "FIELDBUDDY__Priority__c"
        }
    ],
    "table": "FIELDBUDDY__Work_Order__c"
},
```


```
{
  "condition": [
    {
      "table": "FIELDBUDDY__Work_Order__c",
      "field": "FIELDBUDDY__Type__c",
      // Combined with "filter": "out", this means:
      //   Hide this section when FIELDBUDDY__Type__c equals "INSTALLATION"
      //   Show it for all other values (or when blank, because default=true)
      "filter": "out", 
      // Here, with default=true: if Type__c is blank, the condition
      // passes, so the section will be shown.
      "default": true,
      "value": [
        "INSTALLATION"
      ]
    }
  ],
  "iconName": "md-briefcase",
  "iosIconName": "ios-briefcase",
  "table": "FIELDBUDDY__Work_Order__c",
  "mapping": "FIELDBUDDY__Work_Order__c",
  "title": "Section shown if FIELDBUDDY__Type__c != INSTALLATION; It's shown if FIELDBUDDY__Type__c is blank",
  "objects": [
    {
      "name": "Name"
    },
    {
      "name": "FIELDBUDDY__Type__c"
    }
  ]
},
```

> ℹ️ Please note, for conditional rendering of sections, it is only possible to use them on the same sObjects (so you can not filter section on Installed Product using condition on Work Order. You will need to use [https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3113911148](https://upperdeck.atlassian.net/wiki/spaces/FBDOCS/pages/3113911148) for that


It is also possible to do nested conditions

```
{
  "condition": {
    "conditions": [
      {
          "table": "FIELDBUDDY__Installed_Product__c",
          "field": "FIELDBUDDY__Type__c",
          "filter": "eq",
          "value": "Installation"
      },
      {
          "table": "FIELDBUDDY__Installed_Product__c",
          "field": "FIELDBUDDY__Status__c",
          "filter": "in",
          "value": [
              "Installed",
              "Pending"
          ]
      }
    ],
    "operator": "AND"
  }
}
```

and withe jsonQuery:

```
{
  "condition": {
    "conditions": [
      {
          "executor": "jsonQuery",
          "type": "filter",
          "source": "${DATA}",
          "formula": "FIELDBUDDY__Work_Order__c[Id=${CURRENT_WORK_ORDER}&FIELDBUDDY__Closure_Status__c=SOLVED]:isNotEmpty"
      },
      {
          "executor": "jsonQuery",
          "type": "filter",
          "source": "${DATA}",
          "formula": "FIELDBUDDY__Work_Order__c[Id=${CURRENT_WORK_ORDER}].Test_Code__c:isNotEmpty"
      }
    ],
    "operator": "AND"
  }
}
```