--- title: "Variables Component" slug: "variables-component" updated: 2023-02-13T09:56:21Z published: 2023-02-13T09:56:21Z canonical: "help.pillir.io/variables-component" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.pillir.io/llms.txt > Use this file to discover all available pages before exploring further. # Variables Component The Variables component comprises of blocks that are defined to declare and fetch variables. ## Create Local Variable This block creates a **local variable** that is available only within the particular component behavior. The variables created are listed in the **items** oval block dropdown list. The items block can be used within any other component block to declare variables. NoteThe business function variables created in the APM is available by default in the items block dropdown list. | Input | Output | Block Layout | Generated Code | | --- | --- | --- | --- | | Click the "**Create Local Variable**" block to create new variables in the popup window below: ![CreateVariable](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/CreateVariable.png) | Value of variable any type | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907154296.png) Once a variable is created, it can be fetched from the Oval block below: ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907210145.png) ![Itemblock-dropdown](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/Itemblock-dropdown.png) | NA | ## SetValue In this block, the SetValue element adds or updates the value of the current element. | Input | Output | Block Layout | Generated Code | | --- | --- | --- | --- | | Choose Variable Name from the dropdown list, Value(any type) in input-1 | Set value to the variable | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907336441.png)![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907350094.png) | ```javascript var item; async function er_1671099636_change(e,obj,index){ item = 0; ``` | ## Create Object In addition to the existing objects, this block facilitates the user to create new objects. Users can create new objects where the variable blocks can be dragged and dropped. | Input | Output | Block Layout | Generated Code | | --- | --- | --- | --- | | The key or variable name as Text, Value for the key - any type. | Create Object using a key or variable and value pair. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907376131.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907394028.png) | ```javascript {variable_1 : ''} ``` | ## GetObject The GetObject block is used to get the value of a key in an object. | Input | Output | Block Layout | Generated Code | | --- | --- | --- | --- | | Object - input-1 Key or variable name as Text - input-2 | value from the object based on key or variable name. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907414739.png) | ```javascript __er.getState("variable_0").variable_1; ``` | ## SetObject: The SetObject block is used to set a value to the variable in an object. | Input | Output | Block Layout | Generated Code | | --- | --- | --- | --- | | Object - input-1 The key or variable name as Text - input-2 The value for the key as text or variable - input-3 | Set value to the key or variable of the object. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620907447345.png) | ```javascript x.variable_1 = val ``` |