Change node to sort/separate differents objects in array

hello all,

I have an api request from my database containing some data, the aim is to sort them and send in separate messages or in differents objects at least.

the using code is :

downlinks = [ ];

for (var i = 0; i < msg.payload.length; i++) {
    
    downlink = {};
    downlink.eui = msg.payload[i].valve_EUI;

    if (msg.payload[i].System_Activated === null ) {
        downlink.payload = new Buffer("00", "hex");
    } else {
        downlink.payload = new Buffer( "01", "hex");
    }
     

    downlink.port = 1;
    downlink.ack = true;
    downlink.Rxwindows = 1;

    downlinks.push(downlink);
}

return {downlinks};

the general form of my result message is [{xxxxx}, {yyyyyy}, ...],

Could you please help me if I need the result in this format : {xxxxx}, {yyyyyy}, ...

actually i'm using change node by set option I put msg.downlinks to downlinks [0], but the problem is that it results me just the first array, it means : {xxxxx}


**

thanks in advance.

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