Create Array of Different Objects for UI-Table

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?


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.

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

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?

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

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