I have an array with some Objects that I would like to send to a azure queue. I have a simple array with some data and a for that goes trough each element of the array and push it to the queue. Everything goes smooth but when I see the queue I can find only the last member of the array and not all the objects.
My code looks like this:
module.exports = async function (context, myQueueItem) {
var tabdata = []
tabdata =(
{housecode:1,car: 2, familymbembers:5,status:"Error"},{housecode:2,car: 5, familymbembers:4,status:"normal"},{housecode:3,car: 2, familymbembers:4,status:"Error"})
//does some other stuff
for (let i = 0; i < tabData.length; i++) {
if(tabData[i].status == "Error"){
context.bindings.outputQueueError = (tabData[i]);
}
}
context.done();
}
If I try to print the objects after the context.bindings.output I can see that the for and the if are working correctly(I get printed the 0 and 2 object in the array), but in the queue I Can see only the one object with house code 3.
Any help?
Fixxed with using an array of messages
module.exports = function(context) {
context.bindings.myQueueItem = ["message 1","message 2"];
context.done();
};