Format for bulk insert records

  • Goal: im trying to update a table when i do 2 or more modifications

  • Details: in the "array of records to insert" I try this "[ { "id":null;
    "business_id": {{tablaAltas.selectedRow.BUSINESS_ID }};
    "incentivo": "pricing_por_lineas";
    "current_discount": null;
    "alta":{{ tablaAltas.changesetArray[0].alta }};
    "created_by": {{ }} } ]"

and the error says "Records must be an array."

Hi @Elisa_Reynal,

Welcome to the forum!

The table component has a propery called changesetArray which you can use for a Bulk Insert records from a table. Try {{tablaAltas.changesetArray}} and you will see all of the edits of your table.

Bear also in mind that for this to work, your table needs to have a primary key (right below data source) set up. In fact, I noted that you are using the Action Type "Bulk insert records", but from your post it seems you want to update records, so you should selecct "Bulk update via primary key".

Let me know if you need further guidance on how to use table properties.

Thank you for the replay!

The problem is that the tablaAltas does not have the same components than "altas_incentivos_exporter", how does that work?

also the main problem i have is that i do not understad what is wrong with current array. As the error says "data is not an array"

Try it like this:

"id": undefined,
"business_id": {{tablaAltas.selectedRow.BUSINESS_ID}}

Also, if users will be updating only one record at a time, then the GUI for "Update an existing record" may work better than "Bulk insert records".

Thank you! I alreday set up if they wanted to update one record. But I want the user to be able to update more than one record at the time. I will try the solutiion above and come back to you.

good news is i have another problem now jajaj

when im in. the array it says the mail and then undefinded

@Elisa_Reynal if you look in State sidebar for, is it actually undefined? maybe it needs to be wrapped in quotes, but doesn't seem like it.

1 Like

Could it be the last comma after that's causing that?