> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ETL: Using and Setting Variables

> Define, set, and use variables in Integrate.io ETL packages. Pass runtime parameters to jobs and reference dynamic values in your expressions.

## Using and setting variables in your package

You can use variables in most components and fields of a package. You cannot use, for example, variables in the limit component or in alias fields.

Variable values are [expressions](/etl/using-expressions-in-integrateio-etl/ "Link: /etl/using-expressions-in-integrateio-etl/") (except secrets, which are only string) so you can use functions and operators to assign dynamic values to your variables.

Variable values are evaluated only at runtime (when a package is ran), so you must replace these variables with actual values for Integrate.io ETL components (like the Schema step) to work in the package designer.

<Frame>
  <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-8.webp?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=39fcf97d4aedc3a621f8faba6dd89fd7" alt="Variables panel in the package designer" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-8.webp" />
</Frame>

You can use three types of variables:

* Package variables that you define. Value is an expression. You also set the default value.
  <Frame>
    <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-1.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=41893f963a771dd9ed65920757ccfc86" alt="Package variable with name and expression value fields" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-1.png" />
  </Frame>
* Secret variables for sensitive values such as tokes, API keys passwords etc. Value is a string.
  <Frame>
    <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-2.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=557a25ddfb1bea82811ef72917e9501a" alt="Secret variable with masked value field" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-2.png" />
  </Frame>
* System variables for which you can change the default value. Value is an expression. See list [here](/etl/system-and-pre-defined-variables/ "Link: /etl/system-and-pre-defined-variables/").
  <Frame>
    <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-3.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=21061aafd8a2c54ea91e73284d26ec5a" alt="System variable with default value that can be overridden" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-3.png" />
  </Frame>
* Variables predefined by Integrate.io ETL, whose values are set by the system when the job is run. See list [here](/etl/system-and-pre-defined-variables/ "Link: /etl/system-and-pre-defined-variables/").
* Global variables (account level). Value is an expression. Details is [here.](/etl/global-variables-account-level/)
  <Frame>
    <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-4.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=457f686d8721abc9d02532b82b5b730d" alt="Global variable defined at the account level" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-4.png" />
  </Frame>

### Using variables in a variable or a field:

In the required field, type `$` followed by the variable name. For example, if the variable name is country, type `$country`. Note that variables are simply substituted with their values. Therefore if you use a variable where a string value is expected, you should enclose it in single quotes, as in this example: `SUBSTRING('$country',3,5)`

<Frame>
  <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-5.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=26cfddb151f08b8470b43559a6420cce" alt="Using a variable reference with dollar sign in a component field" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-5.png" />
</Frame>

### Using variables in a workflow package:

User variables can be defined at the workflow package level, as well, and can be used for both the Execute SQL Task and the Run Package Task. However, be aware that we address package variables in an Execute SQL Task differently than we described above (i.e. **`$variable_name`**.)  When using variables in a SQL query, enclose the variable within curly brackets (i.e: **'`${var\_name}`'**). See [this](/etl/creating-a-workflow/) document for more information.

<Frame>
  <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-6.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=7c409fb7af681ca87c43f85a5afeacf6" alt="Workflow variables used in Execute SQL and Run Package tasks" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-6.png" />
</Frame>

### Setting variable values in your package

Set package and system variable default values in the package designer. If required, you can override these default values when you run a job through the UI (see [Running jobs](/etl/running-jobs/)), the scheduler or the API.

<Frame>
  <img src="https://mintcdn.com/integrateio/2ttHYDu3EKov-VoY/images/creating-packages/using-and-setting-variables-in-your-packages/image-7.png?fit=max&auto=format&n=2ttHYDu3EKov-VoY&q=85&s=d01fcb7db9a93917d00bf470c00a8784" alt="Setting default values for package and system variables" width="1200" height="828" data-path="images/creating-packages/using-and-setting-variables-in-your-packages/image-7.png" />
</Frame>

**To modify a system variable default value in the package:**

<Steps>
  <Step>
    Click **...**(Set variables)
  </Step>

  <Step>
    Click **system variables**.
  </Step>

  <Step>
    Type a new default value in the relevant text box.
  </Step>
</Steps>

You can also use the following in system variable values:

* Predefined variables
* Another system variable that is listed before the system variable whose value you're editing.

**To define a package variable and set its value:**

<Steps>
  <Step>
    Click **...**(Set variables)
  </Step>

  <Step>
    On the **package variables** tab, type a name and a default value in the relevant text boxes.
  </Step>

  <Step>
    Add additional variables as required.
  </Step>
</Steps>

You can also use the following in package variable values:

* Predefined variables
* System variables
* Another package variable that is listed before the package variable whose value you're editing.

**To override global variables values in the package:**

<Steps>
  <Step>
    Type a name of global variable(s) you want to override under **package variables** tab.
  </Step>

  <Step>
    Set its value.
  </Step>
</Steps>

## Secret Variables

Secret variables store sensitive values such as API keys, tokens, and passwords. They differ from regular package variables in several ways:

* **Encrypted at rest.** Secret variable values are encrypted in storage and never stored in plaintext.
* **Masked in the UI and logs.** Values are replaced with asterisks in the package designer, job logs, and any diagnostic output. You will not see the actual value after saving it.
* **String values only.** Unlike regular package variables (which accept expressions), secret variables accept only string values.
* **Referenced the same way as regular variables.** Use `$variable_name` in fields and expressions, just as you would with any other package variable.

<Steps>
  <Step>Click **...** (Set variables).</Step>
  <Step>Click the **secret variables** tab.</Step>
  <Step>Type a name and value for the secret variable.</Step>
  <Step>Click **Save**. The value will be masked immediately after saving.</Step>
</Steps>

<Warning>
  Once saved, a secret variable's value cannot be viewed again. To change the value, enter a new one and save.
</Warning>
