Add new rows to Table afert each form submission

Hi there, new to Retool there : )

I use Retool to build simple tools around our APIs. I did a form requesting my API when submited. I save JSON result in a table.
So far everything is OK.

But everytime i submit the form, the table get cleaned, i would want to add new rows instead of overwriting the first row at each form submission.

I did not understand the insertQuery part there : https://docs.retool.com/docs/data-in-tables

My simple App :

JSON Result :

{
  "input": {
    "vessel": {
      "imo": 9839210,
      "mmsi": null,
      "speed": 13
    },
    "departure": {
      "portCode": "FRLEH"
    },
    "arrival": {
      "portCode": "USBAL"
    }
  },
  "length": 3319.474512502218,
  "co2EmissionResult": {
    "vesselMethodResult": {
      "co2Wtt": 0.08067071159206923,
      "co2Ttw": 0.977356698134685,
      "co2Wtw": 1.0580274097267541
    },
    "tradeLaneMethodResult": {
      "co2Wtt": 0.043033667580078754,
      "co2Ttw": 0.5532900117438697,
      "co2Wtw": 0.5963236793239485
    }
  }
}

Thanks for your help :slight_smile:

insert the form data into the database, and then run the query that reads the database and populates the table.

1 Like