# All objects in array updated with last UI keying data

**URL:** <https://discourse.nodered.org/t/all-objects-in-array-updated-with-last-ui-keying-data/54214>\
**Category:** General\
**Created:** [24 November 2021 15:18 UTC](https://discourse.nodered.org/t/all-objects-in-array-updated-with-last-ui-keying-data/54214 "2021-11-24T15:18:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zyx09](https://avatars.discourse-cdn.com/v4/letter/z/f19dbf/32.png) [@zyx09](https://discourse.nodered.org/u/zyx09)\
**Post date:** [24 November 2021 15:18 UTC](https://discourse.nodered.org/t/all-objects-in-array-updated-with-last-ui-keying-data/54214/1 "2021-11-24T15:18:11Z")

</div>

Hi, i want keep setup parameter objects on array via Apply ui button.  
Setup parameter will update to connection\_para flow context as object.  
Once finished setup, click ui Apply button save parameter object to store\_conn flow context.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1b6b53f0bd3ff66c07eae5fc221ed2daab7e782.png)

The issue is, i do not know why previous objects in store\_conn all are updated to latest entry setup parameter before click Apply button.

Can anyone help me up. Thank you

```auto
[
    {
        "id": "28feb7a0e5dd4677",
        "type": "tab",
        "label": "Connection",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b385b0076a03c834",
        "type": "ui_button",
        "z": "28feb7a0e5dd4677",
        "name": "Apply",
        "group": "bc8f06f14c192d86",
        "order": 6,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "Apply",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "compare_arrows",
        "payload": "1",
        "payloadType": "num",
        "topic": "",
        "topicType": "str",
        "x": 110,
        "y": 120,
        "wires": [
            [
                "e3e7e9d884b43ca6"
            ]
        ]
    },
    {
        "id": "1e1d534024bc0bcd",
        "type": "debug",
        "z": "28feb7a0e5dd4677",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 120,
        "wires": []
    },
    {
        "id": "e3e7e9d884b43ca6",
        "type": "function",
        "z": "28feb7a0e5dd4677",
        "name": "Store connection parameter",
        "func": "\nif(msg.payload === 1){ \n \nvar options = flow.get('connection_para','file');\n\nvar configs = flow.get('store_conn','file')||[];\n\nvar len = configs.length;\n\nnode.warn(\"length = \" + len);\n\nconfigs[len]= options\n\nflow.set('store_conn', configs,'file');\n\nmsg.payload = configs\n\nreturn msg;\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\n\n\n\nif (flow.get(\"store_conn\", 'file') === undefined) {\n flow.set(\"store_conn\", [],'file')\n}\n\n\nif (flow.get(\"connection_para\", 'file') === undefined) {\n var tag ={};\n tag.name = '',\n tag.address = '',\n tag.portno = null,\n tag.id = null\n flow.set(\"connection_para\",tag,'file')\n}\n",
        "finalize": "",
        "libs": [],
        "x": 360,
        "y": 120,
        "wires": [
            [
                "1e1d534024bc0bcd"
            ]
        ]
    },
    {
        "id": "8686931ca6471c88",
        "type": "change",
        "z": "28feb7a0e5dd4677",
        "name": "set",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.name",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 110,
        "y": 220,
        "wires": [
            [
                "e6c821c382543f5d"
            ]
        ]
    },
    {
        "id": "1f9b7eaf6a1fda57",
        "type": "change",
        "z": "28feb7a0e5dd4677",
        "name": "set",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.tcpHost",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 110,
        "y": 260,
        "wires": [
            [
                "eec80c3b8f84afe9"
            ]
        ]
    },
    {
        "id": "b5e65d71f2ef766e",
        "type": "change",
        "z": "28feb7a0e5dd4677",
        "name": "set",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.tcpPort",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 110,
        "y": 300,
        "wires": [
            [
                "d356c895866980f7"
            ]
        ]
    },
    {
        "id": "75af0d7444980410",
        "type": "change",
        "z": "28feb7a0e5dd4677",
        "name": "set",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.unitId",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 110,
        "y": 340,
        "wires": [
            [
                "0a6a268c8897ce48"
            ]
        ]
    },
    {
        "id": "0a6a268c8897ce48",
        "type": "ui_text_input",
        "z": "28feb7a0e5dd4677",
        "name": "",
        "label": "ID :",
        "tooltip": "",
        "group": "bc8f06f14c192d86",
        "order": 4,
        "width": 3,
        "height": 1,
        "passthru": false,
        "mode": "number",
        "delay": "0",
        "topic": "",
        "sendOnBlur": true,
        "topicType": "str",
        "x": 250,
        "y": 340,
        "wires": [
            [
                "efe60dddbc1a5496",
                "a525eb36a7d7ba42"
            ]
        ]
    },
    {
        "id": "d356c895866980f7",
        "type": "ui_text_input",
        "z": "28feb7a0e5dd4677",
        "name": "",
        "label": "Port :",
        "tooltip": "",
        "group": "bc8f06f14c192d86",
        "order": 3,
        "width": 3,
        "height": 1,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "sendOnBlur": true,
        "topicType": "str",
        "x": 250,
        "y": 300,
        "wires": [
            [
                "b33c38a9f48c346a",
                "a525eb36a7d7ba42"
            ]
        ]
    },
    {
        "id": "eec80c3b8f84afe9",
        "type": "ui_text_input",
        "z": "28feb7a0e5dd4677",
        "name": "",
        "label": "Address :",
        "tooltip": "",
        "group": "bc8f06f14c192d86",
        "order": 2,
        "width": 6,
        "height": 1,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "sendOnBlur": true,
        "topicType": "str",
        "x": 260,
        "y": 260,
        "wires": [
            [
                "e60c77476bed31e8",
                "a525eb36a7d7ba42"
            ]
        ]
    },
    {
        "id": "e6c821c382543f5d",
        "type": "ui_text_input",
        "z": "28feb7a0e5dd4677",
        "name": "",
        "label": "Name :",
        "tooltip": "",
        "group": "bc8f06f14c192d86",
        "order": 1,
        "width": 6,
        "height": 1,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "",
        "sendOnBlur": true,
        "topicType": "str",
        "x": 260,
        "y": 220,
        "wires": [
            [
                "2fe6e6d6b20aa417",
                "a525eb36a7d7ba42"
            ]
        ]
    },
    {
        "id": "2fe6e6d6b20aa417",
        "type": "function",
        "z": "28feb7a0e5dd4677",
        "name": "save",
        "func": "var para = flow.get(\"connection_para\",'file')||{};\n\npara.name = msg.payload;\n\nflow.set(\"connection_para\", para,'file');",
        "outputs": "0",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 180,
        "wires": []
    },
    {
        "id": "e60c77476bed31e8",
        "type": "function",
        "z": "28feb7a0e5dd4677",
        "name": "save",
        "func": "var para = flow.get(\"connection_para\",'file')||{};\n\npara.address = msg.payload;\n\nflow.set(\"connection_para\", para,'file');",
        "outputs": "0",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 220,
        "wires": []
    },
    {
        "id": "b33c38a9f48c346a",
        "type": "function",
        "z": "28feb7a0e5dd4677",
        "name": "save",
        "func": "var para = flow.get(\"connection_para\",'file')||{};\n\npara.portno = msg.payload;\n\nflow.set(\"connection_para\", para,'file');",
        "outputs": "0",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 340,
        "wires": []
    },
    {
        "id": "efe60dddbc1a5496",
        "type": "function",
        "z": "28feb7a0e5dd4677",
        "name": "save",
        "func": "var para = flow.get(\"connection_para\",'file')||{};\n\npara.id = msg.payload;\n\nflow.set(\"connection_para\", para,'file');",
        "outputs": "0",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 380,
        "wires": []
    },
    {
        "id": "a525eb36a7d7ba42",
        "type": "debug",
        "z": "28feb7a0e5dd4677",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 510,
        "y": 280,
        "wires": []
    },
    {
        "id": "15b08c8f811bca6d",
        "type": "ui_spacer",
        "z": "28feb7a0e5dd4677",
        "name": "spacer",
        "group": "4338c48af9891278",
        "order": 5,
        "width": 3,
        "height": 1
    },
    {
        "id": "bc8f06f14c192d86",
        "type": "ui_group",
        "name": "Conn",
        "tab": "c8580ee691688551",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "4338c48af9891278",
        "type": "ui_group",
        "name": "TCP",
        "tab": "299938a3c7ad6096",
        "order": 1,
        "disp": true,
        "width": 6,
        "collapse": false,
        "className": ""
    },
    {
        "id": "c8580ee691688551",
        "type": "ui_tab",
        "name": "06_Connection",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    },
    {
        "id": "299938a3c7ad6096",
        "type": "ui_tab",
        "name": "05_BACNet Network",
        "icon": "dashboard",
        "order": 6,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 November 2021 15:33 UTC](https://discourse.nodered.org/t/all-objects-in-array-updated-with-last-ui-keying-data/54214/2 "2021-11-24T15:33:44Z")

</div>

Welcome to the forum @zyx09

Have a look at the ui\_form widget. That provides input fields of various types and a Submit button. The data for all fields is sent when Submit is clicked which should make your flow much simpler I think.

---

<div class="post-metadata">

**Author:** ![zyx09](https://avatars.discourse-cdn.com/v4/letter/z/f19dbf/32.png) [@zyx09](https://discourse.nodered.org/u/zyx09)\
**Post date:** [25 November 2021 03:35 UTC](https://discourse.nodered.org/t/all-objects-in-array-updated-with-last-ui-keying-data/54214/3 "2021-11-25T03:35:58Z")

</div>

Yes. i will try it.  
Appreciate your advice.  
Happy Christmas..... 😀

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 January 2022 03:36 UTC](https://discourse.nodered.org/t/all-objects-in-array-updated-with-last-ui-keying-data/54214/4 "2022-01-24T03:36:13Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
