---
schema_version: "1"
id: 8b3c1187d77cb16ff91ab6ff07e11a9e94dc149ceb32d44f9a35b6846a848fdb
title: excludes and excludeSelected Attributes in Variables
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_wave_templates/guides/reference/bi-templatesdev-excludes-attributes.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/guide/bi-templatesdev-excludes-attributes.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0b585283c32cee36517089f69bb83567d71f1a9662265349adde92f802caa0a3
products:
  - Analytics Templates Developer Guide
  - analytics
---

# excludes and excludeSelected Attributes in Variables

In variables, use the `excludes` attribute in variables to define values to exclude from selections in response to wizard questions. Use the `excludeSelected` attribute to exclude values that have already been selected in previous wizard questions.

## "excludes" Attribute

Regex Token Definition: `"/<regex pattern>/flags"`

Flags are characters that Javascript RegEx global object takes, for example: g, i, m, u, and so on. Refer to the [RegEx Object API documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) for details.

Example `excludes` statements:

- `"excludes" : ["Name", "/^(Billing).+/"]`—Excludes `Name` field and all the fields that start with `Billing`.
- `"excludes" : ["/^(?!Billing)^(?!Shipping).+/"]`—Excludes all fields except fields that start with `Billing` or `Shipping`.
- `"excludes" : ["/.+(_kav)$/"]`—Excludes all fields that end with `_kav`.
- `"excludes" : ["/^(?:(?!_kav).)*$/"]`—Excludes all fields except fields that end with `_kav`.
- `"excludes" : ["/(?!^Case$|^Account$)(^.*$)/"]`—Excludes all objects except `Case` and `Account`.

**note:** Including a value in `defaultValue` that is excluded results in an error.

## excludeSelected Attribute

In this example, the option selected in `SObjectField1` picker isn’t available in `SObjectField2` picker.

```nolang
"SObjectField1" : {
  "label" : "Select a field from account",
  "description" : "First account field.",
  "defaultValue" : {
    "sobjectName" : "Account",
    "fieldName" : ""
  },
  "required" : true,
  "excludeSelected" : true,
  "variableType" : {
    "type" : "SobjectFieldType"
   }
},
"SObjectField2" : {
  "label" : "Select another field from account",
  "description" : "Second account field.",
  "defaultValue" : {
    "sobjectName" : "Account",
    "fieldName" : ""
  },
  "required" : true,
  "excludeSelected" : true,
  "variableType" : {
    "type" : "SObjectFieldtype"
  }
}
```
