---
title: "Data and variables"
section: "Step reference"
description: "How SmartestQA steps save and read values: variable syntax, the Global parameter step, Get transforms, data sources and Excel columns, and how unresolved variables behave."
url: https://docs.smartestqa.ai/en/automate-steps-variables.html
audience: [customer, admin]
updated: 2026-11-08
keywords: "variable parameter global parameter global param tc ds excel data source get transform trim replace to number round substring default value pass value between steps output"
---
# Step reference: Data and variables

A variable carries a value from one step to another: an order number read from the page, a token from an API, a code from an email. This page explains how to save values, how to refer to them, and what happens when a reference cannot be resolved.

## In short

**On this page you can**

- Read a value saved earlier with {{tc:name}} in any step value.
- Set fixed or combined values with the Global parameter step.
- Clean a value read by Get with transforms such as Trim or To Number.
- Use data source values with {{ds:name}} and Excel columns with {{excel:key}}_column .
- Read a variable of another test case in the same pipeline with {{tc:caseId.name}} .

**How to use it**

1. Add a step that produces a value: Get, an API JSON path, a Database output, a code step set to Value.
2. Give the output a clear name, for example orderId .
3. In a later step, type {{tc:orderId}} or pick it with the parameter picker icon.
4. Add an Assertion on the variable when its value matters.
5. Run a Dry Run and check the resolved value in the live log.

## Pass a value from one step to another

1. **Save the value**

   Use a step that produces an output (see [Steps that produce variables](https://docs.smartestqa.ai/en/automate-steps-variables.html#producers)) and give the output a name such as `orderId`. Names may contain letters, digits and underscore.
2. **Refer to it**

   In any later step value type `{{tc:orderId}}`, alone or inside text: `Order {{tc:orderId}} is ready`. The [picker icon](https://docs.smartestqa.ai/en/automate-test-data.html#insert-variable) next to a value field lists [data sources](https://docs.smartestqa.ai/en/data-source-variables.html#create-key), global parameters and [datasets](https://docs.smartestqa.ai/en/data-source-datasets.html), and inserts the reference for you.
3. **Run**

   When the step runs, the reference is replaced by the value. The [live log](https://docs.smartestqa.ai/en/automate-dry-run.html#live-log) shows the resolved value.

   Example: Type step value `{{tc:orderId}}` → log `"1042" was entered into the "Search" field`.

## Reference syntax

| Write | Reads | Example |
| --- | --- | --- |
| `{{tc:name}}` | A [variable](https://docs.smartestqa.ai/en/automate-test-data.html#variables) saved by a step of this test case (or of a template inside it). | `{{tc:token}}` |
| `{{tc:caseId.name}}` | The variable of another test case that ran earlier in the same [pipeline](https://docs.smartestqa.ai/en/schedule-create.html#run-order). | `{{tc:1484.customerId}}` |
| `{{ds:name}}` | A value from a [data source](https://docs.smartestqa.ai/en/data-source-in-tests.html#reference-syntax) of the project. | `{{ds:adminUser}}` |
| `{{excel:key}}_column` | A column of the current row of an Excel [dataset](https://docs.smartestqa.ai/en/data-source-datasets.html#use-in-steps). | `{{excel:users}}_email` |
| `{{name}}` | The older form, without prefix. It reads a variable of this test case first. Only when no step produced it, and the reference is the whole value, it falls back to a [data source key](https://docs.smartestqa.ai/en/data-source-in-tests.html#reference-syntax) or dataset of that name. Inside longer text it reads only the run’s variables. [Resolution order](https://docs.smartestqa.ai/en/automate-test-data.html#resolution) | `{{otp}}` |

- **[Resolution order](https://docs.smartestqa.ai/en/automate-test-data.html#resolution):** values saved in the current run first, then the project’s stored global parameters.
- **Data-driven runs:** a pipeline can [run a test case once per data row](https://docs.smartestqa.ai/en/automate-test-data.html#data-driven). A [**Dry Run**](https://docs.smartestqa.ai/en/automate-dry-run.html#start-dry-run) uses only the first row.
- **Where it works:** in every step value, including URLs, [request bodies and headers](https://docs.smartestqa.ai/en/automate-steps-api.html#request-fields), [SQL queries](https://docs.smartestqa.ai/en/automate-steps-database.html#sql-rules), [mail filters](https://docs.smartestqa.ai/en/automate-steps-mail.html#fields), [Kafka messages](https://docs.smartestqa.ai/en/automate-steps-kafka.html#produce), [AI prompts](https://docs.smartestqa.ai/en/automate-steps-ai.html#add-ai-step) and [code](https://docs.smartestqa.ai/en/automate-steps-code.html#add-code-step).

> **Warning: Unresolved references stay as text**
>
> If no value is found, the reference is not replaced: a Type step types `{{tc:orderId}}` into the field. An Assertion treats it as empty and logs “{{tc:orderId}} not found, treated as empty”. Check the spelling and that the producing step ran before. See [Troubleshooting](https://docs.smartestqa.ai/en/automate-steps-troubleshooting.html#fix-variable-literal).

## Steps that produce variables

| Step | How you name the output | What it holds |
| --- | --- | --- |
| [Get](https://docs.smartestqa.ai/en/automate-steps-browser.html#get) (web) | The parameter key | The element’s text, or its value |
| Get Text, Get Attribute, Store Variable ([mobile](https://docs.smartestqa.ai/en/automate-steps-mobile.html#data), [desktop](https://docs.smartestqa.ai/en/automate-steps-desktop.html#data)) | The variable name in the step | Text, an attribute, or a fixed value |
| [Global parameter](https://docs.smartestqa.ai/en/automate-steps-variables.html#global-parameter) | The key | The value you set (variables in it are resolved) |
| [API Request](https://docs.smartestqa.ai/en/automate-steps-api.html#extract-values) | The key of a [**JSON Paths**](https://docs.smartestqa.ai/en/automate-steps-api.html#extract-values) row | A response field, `@status` or a header |
| [Database](https://docs.smartestqa.ai/en/automate-steps-database.html#outputs) | [**Output Values**](https://docs.smartestqa.ai/en/automate-steps-database.html#outputs), in column order | Column values of the first row (or row N) |
| [Extract OTP, Extract Link, Wait for Mail](https://docs.smartestqa.ai/en/automate-steps-mail.html#outputs) | [**Output Variable**](https://docs.smartestqa.ai/en/automate-steps-mail.html#fields), **Subject Output**, **Content Output** | The code, the link, the subject, the body |
| [Network](https://docs.smartestqa.ai/en/automate-steps-network.html#outputs) | [**Save to variable**](https://docs.smartestqa.ai/en/automate-steps-network.html#outputs) rows | Status, body field, header, duration, call count… |
| [Python, JavaScript](https://docs.smartestqa.ai/en/automate-steps-code.html#output-modes) | Output set to **Value**, with a name | The value the code returns |
| [AI Ask, AI Check, AI Chat](https://docs.smartestqa.ai/en/automate-steps-ai.html#outputs) | [**Output Value**](https://docs.smartestqa.ai/en/automate-steps-code.html#output-modes) = **Value**, **Variable Name** | The AI’s answer |

- Names that [produce a global parameter](https://docs.smartestqa.ai/en/automate-test-data.html#produce-variables) must be unique within the test case. Saving two outputs with the same name shows [“Names that produce a global parameter must be unique within the test case. Conflicts: …”](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-duplicate-keys).
- If two earlier steps set the same name, the later one wins at run time.
- Values longer than 8,000 characters are not saved.

## The Global parameter step

Sets one or more variables to values you choose, without touching the app. Use it for [test data](https://docs.smartestqa.ai/en/automate-test-data.html#variables) that several steps share, or to build a value from others (`{{tc:firstName}}.{{tc:lastName}}@example.com`). It exists in every project type.

1. **Open the dialog**

   Click **More** › **Global parameter** (on wide screens the toolbar shows it as **Param**). The dialog **Add Global Param Step** opens.
2. **Fill it**

   [**Test Step Name**](https://docs.smartestqa.ai/en/automate-editor.html#rename-step), then **Key** (the variable name) and **Value**. The [picker icon](https://docs.smartestqa.ai/en/automate-test-data.html#insert-variable) inserts a data source, global parameter or dataset reference.
3. **Add more values**

   Select the step and use [**Add Param**](https://docs.smartestqa.ai/en/automate-editor.html#step-parameters) in the right panel for more key and value pairs.

   The step shows the chip **Param**. When it runs, each value is resolved and saved; the log lists the keys and values.

If the key is already registered as a global parameter by another source, saving shows [“This key is already registered as a global parameter, please change the key value.: key”](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-global-param-exists). Pick another name.

## Transforms on Get steps

A [Get step](https://docs.smartestqa.ai/en/automate-steps-browser.html#get) can clean the value it reads before saving it. Add a transform row in the right panel; transforms run in order, after the value is read. Transforms are offered only on Get steps.

| Transform | Value | Example |
| --- | --- | --- |
| Trim | Optional characters | `  34  ` → `34`; with `*`: `*34*` → `34` |
| Trim Before | A text | `USD:34` with `:` → `34` (removes the text and what comes before it) |
| Trim Before Back | A text | `34*` with `*` → `34` (from the last match, removes it and what follows) |
| Upper Case / Lower Case | None | `ok` → `OK` |
| Replace | `old=>new` | `1.234` with `.=>` → `1234` |
| To Number | None | `€ 1.234,56` → `1234.56` (the last of `.` or `,` is the decimal mark) |
| To Integer | None | `76.9` → `76` |
| Round | Number of decimals | `3.14159` with `2` → `3.14` (binary rounding: `76.945` becomes `76.94`) |
| Default Value | A fallback | empty → `N/A` |
| Substring | `a:b` | `2026-11-08` with `0:4` → `2026` |

A transform that cannot apply (no number found, no match) leaves the value unchanged; the step does not fail. The **Timeout** row sets how many seconds this Get step waits for its element (1–300).

## How long a variable lives

- Within a test case, a variable is [available to every step after the one that saved it](https://docs.smartestqa.ai/en/automate-test-data.html#variable-scope), including steps inside [templates](https://docs.smartestqa.ai/en/automate-steps-flow.html#template).
- In a [pipeline](https://docs.smartestqa.ai/en/schedule-create.html#run-order), a later test case reads it as `{{tc:caseId.name}}`.
- Outputs are also stored as the project’s global parameters, so a reference can resolve to [a value from an earlier run](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-stale-value) when the producing step did not run this time. Keep producing steps before the steps that read them.
