> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.utils.controls.SetVariable

- Component: `appmixer.utils.controls.SetVariable`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.utils.controls 1.14.7](https://connectors.appmixer.com/connector/appmixer.utils.controls/1.14.7.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.utils.controls/1.14.7/component/appmixer.utils.controls.SetVariable>

Component to set a variable based on input type and value.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Variables (`variables`) | expression | Provide the variables. |

## Output ports

### Port `out`

Variables are loaded dynamically from `/component/appmixer/utils/controls/SetVariable?outPort=out`.

## Full metadata (component.json)

```json
{
  "name": "appmixer.utils.controls.SetVariable",
  "author": "Harsha Surisetty <harsha@client.io>",
  "description": "Component to set a variable based on input type and value.",
  "icon": "(data URI omitted)",
  "private": false,
  "inPorts": [
    {
      "name": "in",
      "maxConnections": 1,
      "schema": {
        "type": "object",
        "properties": {
          "variables": {
            "type": "object"
          }
        },
        "required": [
          "variables"
        ]
      },
      "inspector": {
        "inputs": {
          "variables": {
            "type": "expression",
            "label": "Variables",
            "levels": [
              "ADD"
            ],
            "index": 1,
            "tooltip": "Provide the variables.",
            "fields": {
              "text": {
                "type": "text",
                "label": "Value",
                "index": 1,
                "tooltip": "Enter a text value.",
                "when": {
                  "eq": {
                    "./type": "text"
                  }
                }
              },
              "textarea": {
                "type": "textarea",
                "label": "Value",
                "index": 1,
                "tooltip": "Enter a textarea value.",
                "when": {
                  "eq": {
                    "./type": "textarea"
                  }
                }
              },
              "date-time": {
                "type": "date-time",
                "label": "Value",
                "index": 1,
                "tooltip": "Pick a date and time.",
                "when": {
                  "eq": {
                    "./type": "date-time"
                  }
                }
              },
              "number": {
                "type": "number",
                "label": "Value",
                "index": 1,
                "tooltip": "Enter a number value.",
                "when": {
                  "eq": {
                    "./type": "number"
                  }
                }
              },
              "toggle": {
                "type": "toggle",
                "label": "Value",
                "index": 1,
                "defaultValue": false,
                "tooltip": "Toggle a value.",
                "when": {
                  "eq": {
                    "./type": "toggle"
                  }
                }
              },
              "filepicker": {
                "type": "filepicker",
                "label": "Value",
                "index": 1,
                "tooltip": "Select a file.",
                "when": {
                  "eq": {
                    "./type": "filepicker"
                  }
                }
              },
              "name": {
                "type": "text",
                "label": "Name",
                "index": 2,
                "tooltip": "Enter the variable name."
              },
              "type": {
                "type": "select",
                "label": "Type",
                "index": 3,
                "tooltip": "Select the variable type.",
                "defaultValue": "text",
                "options": [
                  {
                    "label": "Number",
                    "value": "number"
                  },
                  {
                    "label": "Text",
                    "value": "text"
                  },
                  {
                    "label": "Textarea",
                    "value": "textarea"
                  },
                  {
                    "label": "Date",
                    "value": "date-time"
                  },
                  {
                    "label": "Boolean",
                    "value": "toggle"
                  },
                  {
                    "label": "File",
                    "value": "filepicker"
                  }
                ]
              }
            }
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "source": {
        "url": "/component/appmixer/utils/controls/SetVariable?outPort=out",
        "data": {
          "properties": {
            "generateOutputPortOptions": true
          },
          "messages": {
            "in/variables": "inputs/in/variables"
          }
        }
      }
    }
  ]
}
```
