You need to do a batch insert query and roll your own array to send back to the server. Here is a snippet from my Retool Patterns document I am compiling to help me remember how to do things. This example is a bulk update, but the process is the same for a bulk insert.
Creating an Array From Scratch
You may be doing a bulk insert on a table that you do not have a query or table for, a many-many linkage table for instance, and you need to get columns from multiple sources, use this pattern.
First you need a Temporary State var to hold the array between steps. bulkBundle in this example. It does not need a Default Value
Next you need to create a js query that will build the array which is used by the Bulk query. This example updates records to the line_items table and uses the current invoiceid as the foreigh key.
// jsMakeBulkBundleArray
var newData = [];
tblLineItems.selectedRow.data.forEach(row => {
newData.push({
line_item_id: row.line_item_id,
bundled_sku: tblProducts.selectedRow.data[0].sku
})
});
bulkBundle.setValue(newData);
Next up, make the actual sql bulk query. Use the temp state var as your source for the array.
Now make another js query that will tie it all together.
// jsBulkBundle
jsMakeBulkBundleArray.trigger({
onSuccess:function(data) {
qryBulkBundle.trigger()
}
});
Finally you need to trigger the jsBulkBundle query from somewhere like a save button.