const loanRows = uploadProducts.data
let errors = "";
let table5 = [];
// declare function to trigger query
function createProduct (counter) {
if (counter >= loanRows.length) {
console.log("Finished running all queries");
} else {
createProducts.trigger({
additionalScope: {i: counter},
onSuccess: function (data) {
//call function
createProduct(counter + 1);
},
onFailure: function () {
// create logs
let newObj = {};
newObj.merchantID = uploadProducts.data[counter].merchantId;
newObj.name = uploadProducts.data[counter].name;
newObj.error = createProducts.data.message;
// add row to logs table
table5.push(newObj);
//call function
createProduct(counter + 1);
},
})
}
}
// call function
createProduct(0);
// return logs table
return table5;
i have this process where i want to iterate over a table component , then perform a trigger operation to using a query to post those items in the table to a database endpoint, i am trying to identify rows that failed the query operation and store them in a table component in retool. my current process doesnt seem to work, can someone please shed light on another way to achieve? or help me figure out why the on failure block of the code does'nt return an object array.