I'm very new to database building/sql and i'm trying to get the changesetarray to work for a table I have.
I have a table with data that I want to be able to be updated if someone makes a spelling mistake, needs to update the contact info, etc for my vendors.
I made a query with the GUI for bulk update via primary key and I keep getting the error: "Data must be an array"
So the variables are case sensitive, and it seems your table is Vendor_Table with caps, so that may be the reason why your query gets that error, as is returning undefined. Can you give it a try with Vendor_Table.changesetArray?
Glad to hear the scoping error is gone. The "Data must be an array" should be straightforward to solve.
I am somewhat surprised that the data from the MySQL query to vendor_table needs to be formatted but you can add in a transformer to the query to add [] around the data and it will then be an array.
In my example where I had data that was not in an array for the table component to iterate through, I added the [ ] to the query that fills in the table.
This is the same query that runs on success after the update query runs that uses the data from the changeSetArray.
I am glad to hear you got things working!
I am confused as to why adding the [ ] to the transform results caused that
If every item in the columns is getting turned into an array, that is occurring at a level lower down into the data, and the purpose of wrapping all the data with [ ] was to do so at the top level.
If you can share the table query, the updating the DB query and the event actions that could be very helpful for future users!
I know you mentioned you were note exactly sure how but that you managed to get this working on your end. If you care to share any screen shots that you think would be helpful to any other users running into the same issue that would be amazingly helpful!