# 2b. Configuring Variable Rules

## Variable Rules <a href="#id-2b.configuringvariablerules-variablerules" id="id-2b.configuringvariablerules-variablerules"></a>

| Users can create rules for variable extraction and assignment (global settings) and these rules can be applied to the recorded session (. **prxdat**) at any time. These configuration settings are found in the **Personal Settings** dialog. |   |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| After clicking the Configure Var Rules button the following Variables Rule Configuration Dialog Box will appear:                                                                                                                               |   |

### Add A Rule <a href="#id-2b.configuringvariablerules-addarule" id="id-2b.configuringvariablerules-addarule"></a>

Add a Boundary-based rule or Regex-Based Rule.

| **Field, Definition, and Procedure**                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | **Screenshot**                                                                                                                                                                                                                                                                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>Rule Name</strong>: The name of the rule to be added. The rule name should be unique for each rule.</p><p><strong>Variable Prefix</strong>: The prefix to be used while creating automatic variables based on this rule. The variable prefix should be unique.</p>                                                                                                                                                                                                                                    | <p></p><p><strong>Extract from</strong>: Where to extract the variables from. There are two options: (1) Response Header and (2) Response Content. If the <strong>Response Header</strong> is selected, the var extractors will be created from <em>response headers</em>. If <strong>Response Content</strong> is selected, the var extractors will be created from <em>response content</em>.</p> |
| **Rule Type**: The type of rule to be added. There are two options - Boundary Based Rule and Regex Based Rule.                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Boundary Based Rule details**: These details will be used to extract a text based on the left and right boundaries inside the HTTP response header/content.                                                                                                                                                                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Regex Based Rule details**: These details will be used to extract a text based on the configured regular expression inside the HTTP response header/content.                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p><strong>Assign Var Options</strong>: Configures how the automatically-created vars will be assigned. There are two options<br>1. Assign Var automatically to all HTTP requests which contain the same text pattern (<em>full binary replacement of recorded value over all the requests</em>).<br>2. Assign var automatically to all HTTP requests which contain form or CGI parameters with the same recorded value. You can also try to match URL encoded text.</p>                                         | <p></p><p>If the Assign with <strong>{$Var Name}</strong> pattern is checked, the assignment in the request (URI, headers and Content) will be replaced by <strong>{$Var Name}</strong> pattern</p>                                                                                                                                                                                                 |
| Once you click on the **Add Rule** button, the new rule will be listed in the List of Rules section. By default, the newly-added rule will be enabled.                                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                                                                                                                                                                                                                                                                     |
| <h3 id="id-2b.configuringvariablerules-delete-modify-enable-disablerules">Delete, Modify, Enable, Disable Rules</h3>                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                                                                                                                                                                                     |
| <h3 id="id-2b.configuringvariablerules-modifyarule"><strong>Modify a Rule</strong></h3><p></p><p>Once a rule is added and in place, it can be modified by clicking on the Modify icon to the left of the Rule name within the List of Rules section</p><p>Note: The Rule Type cannot be modified.</p><h3 id="id-2b.configuringvariablerules-deleterule"><strong>Delete Rule</strong></h3><p></p><p>To remove a rule, click on the Delete icon to the left of the Rule name within the List of Rules section.</p> | <p></p><h3 id="id-2b.configuringvariablerules-enable-disablerule"><strong>Enable/Disable Rule</strong></h3><p></p><p>Click on the toggle buttons to enable or disable a rule.</p><p>Note: Only the enabled rules will be applied to the recording to create automatic vars.</p>                                                                                                                     |

### &#x20;**Applying the Rules** <a href="#id-2b.configuringvariablerules-applyingtherules" id="id-2b.configuringvariablerules-applyingtherules"></a>

A new **Apply Var Rules** icon in the Main Menu will allow you to replace all existing variables automatically.

| **Directions**                                                                                                                                                   | **Screenshot** |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| Click on the **Apply Var Rules button** once the recording of a session is completed to apply the enabled rules on that recording.                               |                |
| It will automatically create Var extractors from Response header/content and Var assigners to Request header/content based on the enabled rules after recording. |                |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apica.io/platform-docs/zebratester-scripting/zebratester-user-guide/2.-scripting-the-load-test-session/2.-correlation-dynamic-session-parameters/2b.-configuring-variable-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
