---
schema_version: "1"
id: 8559f08e8eaeddc58f89f6311f1ad7edc1243b4984aa7156687f72426e7fdc57
title: Edit variables.json
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_wave_templates/guides/concept/bi-templatesdev-edit-variables-json.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/guide/bi-templatesdev-edit-variables-json.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c1409b0c01830a333c48b4fca980d0fe7a16645aefda0b355e59b82b21206345
products:
  - Analytics Templates Developer Guide
  - analytics
---

# Edit variables.json

The `variables.json` file describes all the variables used in the `template-info.json`, `ui.json`, and the different `rules.json` files.

`variables.json` includes text for wizard questions, descriptions, and specifications for the answers. Variables also define conditional questions. For example, if you want some questions to appear in the wizard only if an org contains certain data. Or you want to add more specific questions based on the answers to more general wizard questions.

Variables enable the customization of apps; without them, everything is hard-coded. Variables allow the framework to replace tokenized data with customer-specific data.

## Variables Syntax

Variables are declared in the following format:

```nolang
{
    "<variableName>" : <variableDefinition>
}

```

Each variable has a unique name. Here are the parts of a variable definition.

**label**

(Required) Text for the label in the wizard, formatted as a question the user selection answers.

**description**

(Optional) Text for the description in the wizard, formatted to help the user select the correct response.

**defaultValue**

(Optional) Default value for the answer to the wizard question.

**required**

(Optional) Indicates whether an answer to the wizard question is required (`true`) or not (`false`). The default is `false`.

**variableType**

(Optional) The type of the variable. The list of valid variable types is [here](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/reference/bi-templatesdev-variables-json-attributes.md). Defaults to `StringType` if not specified.

**excludes**

(Optional) Defines values to exclude from selections in response to the wizard question. The values are a list of comma-separated field names or regex tokens to not show in a picker.

**excludeSelected**

(Optional) Excludes previously selected values from selections in response to subsequent wizard questions. The default is `false`. If there are two or more pickers with the same source and variable type and this field is `true` for both, the selected option is excluded from the list of options in the other picker.

## Examples

**Generic variable**

```nolang
"<Name of a variable>" : {  
    "label" : "<Question to display>",
    "description" : "<Text to help user select/provide the right value>",  
    "variableType" : { "type" : "SobjectType" },
    "defaultValue" : { "sobjectName": "User" },  
    "required" : true,
    "excludes" : [ "AboutMe", "Division"],
    "excludeSelected" : true
}

```

**NumberType variable with enumerated values**

```nolang
"numberExampleByTens" : {
   "label" : "What's the maximum number to use for the offset?",
   "description" : "Choose a value between 10 and 100",
   "defaultValue" : 80,
   "required" : true,
   "variableType" : {
       "type" : "NumberType",
       "min" : 0,
       "max" : 100,
       "enums" : [10,20,30,40,50,60,70,80,90,100]
   }
}
```

**BooleanType variable**

```nolang
"booleanExample" : {
    "label" : "Please define the boolean parameter?",
    "description" : "Some boolean value.",
    "defaultValue": false,
    "required" : true,
    "variableType" : {
        "type" : "BooleanType",
    }
}

```

**SobjectFieldType array variable**

```nolang
"sobjectFieldArrayExample" : {
    "label" : "Select the user name fields?",
    "description" : "The user fields to use.",
    "defaultValue" : [
       {"sobjectName" : "User", "fieldName" : "FirstName"},
       {"sobjectName" : "User", "fieldName" : "LastName"},
    ],
    "required" : true,
    "variableType" : {
       "type":"array"
    }
    "itemsType" : {
        "type" : "SobjectFieldType",
        "dataType" : "xsd:string"
     }
    }
}

```

To use this variable, call it with the following:

```nolang

${Variables.sobjectFieldArrayExample[0].sobjectName}
${Variables.sobjectFieldArrayExample[0].fieldName}
${Variables.sobjectFieldArrayExample[0]}

```

See additional detail and examples in the sections that follow.

- **[Simple Variable Types for variables.json](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/reference/bi-templatesdev-simple-var-types-variables-json.md)**


    We call the following variable types “simple” because they’re standard, predefined datatypes.

- **[Complex variables.json Variable Types](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/reference/bi-templatesdev-complex-var-types-variables-json.md)**


    Complex variable types are unique to Salesforce, for example, `sobject`, `sobjectField`. Use them to query the org for access to data from Salesforce objects. Scroll to the right to view example values. Examples for each type appear below the chart.

- **[Array Variable Type for variables.json](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/guide/bi-templatesdev-array-type-variables-json.md)**


    Use an `ArrayType` variable to create a wizard question that accepts multiple selections. The user can make multiple choices from a list of values. Define a minimum and maximum for the number of items that can be selected.

- **[excludes and excludeSelected Attributes in Variables](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/reference/bi-templatesdev-excludes-attributes.md)**


    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.

- **[Use Case and Syntax for Variables with Related Values](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/guide/bi-templatesdev-var-value-ref-use-case-variables-json.md)**


    Construct variables that reference related values, for example an object and fields from the object, and a dataset and dates, dimensions, and measures from the dataset.

**See Also**

- [variables.json Attributes](https://developer.salesforce.com/docs/analytics/bi-dev-guide-wave-templates/reference/bi-templatesdev-variables-json-attributes.md)
