# Create Array of Different Objects for UI-Table

**URL:** <https://discourse.nodered.org/t/create-array-of-different-objects-for-ui-table/66583>\
**Category:** Share Your Projects\
**Created:** [18 August 2022 04:27 UTC](https://discourse.nodered.org/t/create-array-of-different-objects-for-ui-table/66583 "2022-08-18T04:27:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kimo](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@Kimo](https://discourse.nodered.org/u/Kimo)\
**Post date:** [18 August 2022 04:27 UTC](https://discourse.nodered.org/t/create-array-of-different-objects-for-ui-table/66583/1 "2022-08-18T04:27:44Z")

</div>

Hi.  
I have a case where user can key in multiple times of input and these inputs will be sent & displayed on ui-table. However, my issue now is how to store/create those different objects/inputs in one array so I can display the inputs to ui table?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/0/b00a34f804bf7a44431e99e730d4e72811103a68.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7d29f72c76c19e33ab2c426a57d9ee4c0b14c066.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [18 August 2022 09:07 UTC](https://discourse.nodered.org/t/create-array-of-different-objects-for-ui-table/66583/2 "2022-08-18T09:07:51Z")

</div>

Have you thought about using the `ui-form` node instead of seperate `ui-text` nodes. That way all the information would be entered and sent at the same time.

---

<div class="post-metadata">

**Author:** ![Kimo](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@Kimo](https://discourse.nodered.org/u/Kimo)\
**Post date:** [18 August 2022 15:49 UTC](https://discourse.nodered.org/t/create-array-of-different-objects-for-ui-table/66583/3 "2022-08-18T15:49:41Z")

</div>

Yes. ui-form is good, but it not gives me flexibility in terms of placement/arrangement, looks, etc like what text input node offers. Nvermind, I got a way that solved my issue using below function

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b2bfc2224731707c558820355fbe28abad48b68.png)

However, I got result when I try to key in input for first time, data is updated onto ui table as soon as I pressed submit button, but when key in for second time, new data is not displayed on ui table unless I refresh the page. Any thought on this?

---

<div class="post-metadata">

**Author:** ![Kimo](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@Kimo](https://discourse.nodered.org/u/Kimo)\
**Post date:** [9 October 2022 06:44 UTC](https://discourse.nodered.org/t/create-array-of-different-objects-for-ui-table/66583/4 "2022-10-09T06:44:49Z")

</div>

I managed to solve this issue long time ago. So, maybe someone is looking around on same issue, the answer is to use push method. The steps are to push the variable arr which capture all the required property of message into an array

```auto
let array = flow.get('array');
if(array === undefined){
    array = [];
}
//create object arr
var arr =  
    {
    "No":msg.payload.Name[0].Name,
   .....
   .....
    };
msg.payload = arr;

array.push(msg.payload);
flow.set('array', array);
return msg;

```

Then, next step can refer to this link below

> [@Send payload of array to UI-Template Table](https://discourse.nodered.org/t/send-payload-of-array-to-ui-template-table/66536/12):
>
> the ui-template flow now transfered to ui-table flow: [ { "id": "fd3a93decc2a1270", "type": "tab", "label": "e.g. ui-table", "disabled": false, "info": "" }, { "id": "ec34c6ada52855bd", "type": "change", "z": "fd3a93decc2a1270", "name": "Table Configuration", "rules": [ { "t": "set", "p": "ui\_control", "pt": "msg", "to": "$format…
