> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoy-developer/object-editors/variable-editor.md).

# Variable Editor

Reference documentation for Variable editor

## Overview

The **Variable Editor** is used to add or edit a variable in a scope or a form's scripting file.

<figure><img src="https://3933488479-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpWd52BKwABWxF2lScUK%2Fuploads%2Fgit-blob-3768e8e549809a036f25696ab01949faffc6d483%2Fnew-variable-editor.jpg?alt=media" alt=""><figcaption><p>Variable Editor</p></figcaption></figure>

## Sections

### Name and Type selection

* **Name** : Enter the name for your variable in the `Name` field. Choose a name that is descriptive of the data it will hold.
* **Type** : Select the type of the variable from the "Type" dropdown. The options available in the screenshot include:
  * TEXT: for string values.
  * INTEGER: for whole numbers.
  * NUMBER: for numerical values, which can include decimals.
  * DATETIME: for date and time values.
  * MEDIA: for media objects, such as images or files.\
    Choose the type that best fits the kind of data you intend to store in the variable.

### Default value

* **Default value** : Specify the initial value for the variable.

You can choose between:

* **js expression**: Write a JavaScript expression that evaluates to the initial value of the variable.
* **value**: Manually enter a literal value.

### Buttons

* **OK** : Click this button to create the variable with the specified name, type, and default value.
* **Cancel** : Click this button to close the dialog without creating the variable.

## Example

If you want to create a variable to hold a string representing a user's name with an initial value of `John Doe`, you would:

1. Enter `userName` in the `Name` field.
2. Select `TEXT` from the `Type` dropdown.
3. Choose value and enter `John Doe` as the default value.
4. Click `OK` to create the variable.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.servoy.com/reference/servoy-developer/object-editors/variable-editor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
