Transform results bulk insert records GUI

Dear community:

I am trying to bulk insert records using GUI mode for a Retool Database. I have created a transformer that imitates the exact names of properties for each record to insert, then I transform the array in the same GUI, adding a UUID, so that it inserts with an ID. However this error appears... I find it very strange, since when I do a preview, it shows like it works.

Error:Could not evaluate transformer: orderItems is not iterable}
in saveOrderItems transformer(saveOrderItems)
from saveOrderItems response(saveOrderItems)
:arrow_forward: in saveOrderItems.trigger()(saveOrderItems)

This is what appears when I click on "Preview"

Here's the transform results code

const updatedData = [];
const orderItems = data.recordsToInsert;
  for (const item of orderItems) {
    const newItem = { ...item, id: uuid.v4() };

data.recordsToInsert = updatedData

return data;

I think you should transform the data (orderItemsOutput.value first and then use that as the Array of records to insert...