Passing value in additionalScope from one postgreSQL query to another

hiii :slight_smile: I need your help!:slight_smile:
in one SQL query I'm adding onSuccer trigger to a JS query handleID

Screenshot 2023-07-06 at 20.59.59|690x278

the handleID looks like this

then with the JS query handleID i trigger another SQL query (to acctually send data to database)

it gives the following mistakes :frowning:
Screenshot 2023-07-06 at 21.02.15

basically I want to add data from one form to sql databse (retool database) to 2 tables
with one submit button :slight_smile:
for the second table I need matching ID for the record, so I need to somehow pass it from the first submit, or retrive from database and add on the second query.
BUT any idea why the additionalScope is not working?

1 Like

Ok, so I did it like this.

  1. From the first SQL query I got the ID of the record that was generated in the database.
  2. I passed the ID via additionalScope to a JS query.

  1. It triggered the handleID function that created an object I wanted to bulk insert to database

  2. and via another additionalScope I passed the object (and triggered SQL query)

  1. so my final SQL query that sends data via buld insert to the database looks just like this
1 Like