# Set the properties of a variable

Set the properties of a variable by using the [SetProperties method](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/service-genericvariable-setproperties.htm).

Information noteYou cannot update the properties of a script-defined variable using the [SetProperties method](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/service-genericvariable-setproperties.htm). For this, you need to update the script.

## Example

[](https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/WorkingWithAppsAndVisualizations/SetGetProperties/set-properties-variable.htm)

#### SetProperties method

Prerequisite:

The variable VB01 is previously created. The handle of the variable is 2.

1. Get the properties of the variable.

The client sends:

```
{
	"handle": 2,
	"method": "GetProperties",
	"params": {},
	"id": 2,
	"jsonrpc": "2.0"
}
```

The engine returns:

```
{
	"jsonrpc": "2.0",
	"id": 2,
	"result": {
		"qProp": {
			"qInfo": {
				"qId": "VB01",
				"qType": "Variable"
			},
			"qMetaDef": {},
			"qName": "Variable01",
			"qComment": "My first variable",
			"qNumberPresentation": {
				"qType": "U",
				"qnDec": 10,
				"qUseThou": 0
			},
			"qDefinition": "=Count(Holes)"
		}
	}
}
```

The properties of the variable are returned.

2. Update the properties of the variable. A new name is given to the variable (in qName). The property qIncludeInBookmark is set to true. The definition of the variable is modified (in qDefinition).

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "SetProperties",
  "handle": 2,
  "params": [
    {
      "qInfo": {
        "qId": "VB01",
        "qType": "Variable"
      },
      "qName": "Variable02",
      "qIncludeInBookmark": true,
      "qDefinition": "=Sum(Holes)"
    }
  ]
}
```

The engine returns:

```
{
	"jsonrpc": "2.0",
	"id": 3,
	"result": {},
	"change": [
		1,
		2
	]
}
```

The properties are updated.

3. Get the properties of the variable.

The client sends:

```
{
	"handle": 2,
	"method": "GetProperties",
	"params": {},
	"id": 4,
	"jsonrpc": "2.0"
}
```

The engine returns:

{ "jsonrpc": "2.0", "id": 4, "result": { "qProp": { "qInfo": { "qId": "VB01", "qType": "Variable" }, "qMetaDef": {}, "qName": "Variable02", "qNumberPresentation": { "qType": "U", "qnDec": 10, "qUseThou": 0 }, "qIncludeInBookmark": true, "qDefinition": "=Sum(Holes)" } } }

The properties of the variable VB01 are returned. They have been updated accordingly to what was defined by the [SetProperties method](https://help.qlik.com/en-US/sense-developer/May2026/Subsystems/EngineJSONAPI/Content/service-genericvariable-setproperties.htm).