On a certain condition, I am doing an Add New Row Data Action from current table to a MYSQL table, but Whenever I am adding a new row, its running an update query on my MYSQL database based on the KEY column of table in Appsheet.
I just cant figure it out. When I change the datasource to a google sheet, it works fine.
Please help
Do you have a stored procedure within your SQL database? I think what you are saying is that you are adding a new row in Appsheet where the datasource is a table in MySQL. Then it runs an update query in MySQL. So, if you have a stored procedure in MySQL that runs on ADD new row, that would be an expected behaviour because Appsheet add new row would result in an add new row within MySQL and therefore trigger any stored procedures.
Dear Markus, Thanks for the reply. I do not want to update. I do not have any stored procedures also. I just want to do a simple add a new row to my mysql database but whenever I am doing so, instead of adding a new row, its adding a row as well as changing all the records in mysql database (wherever the key column in my appsheet table matches the sql table column) So instead of adding a new record say - john-phpdeveloper-12k, its adding this record as well as changing all records in my mysql table wherever designation is phpdeveloper, so now I have multiple records saying john-phpdeveloper-12k
Do you have multiple records in your MySQL with the same value in your key column specified in the app?
yes, infact I dont have a primary key in my mysql table. Appsheet makes it mandatory to select a key, if the default row_num is selected as the key the add new row doesnt happen, but if i select another column as a key, the add new row seems to search for a match in mysql, then adds a row and also updates all rows containing that value. What am I doing wrong here? If I change the mysql table to a google sheet it works fine, so the logic is ok...
You need to select a column as a key where all rows have a unique value. Otherwise weird things can happen. The rownumber with the gSheet is not a good key column either because if you delete the row from the gSheet all key values are then changed.
User | Count |
---|---|
16 | |
13 | |
8 | |
7 | |
4 |