Hello, I would like to upload a file to S3, save the filename in a files table and then assign the new file_id to a row in another table
Thus, I have created three requests :
uploadFile which uploads to S3
storeFile which upsert in table files in Retool DB
patchUser which update the user table in Retool DB
Solution tried:
On the submit of the image input, run a script
1 - The file_id « storeFile.data.result[0].id » does not retrieve the newly created file_id but the one before (see screenshot). Why ? The query is run onSuccess of the previous one. Thus, the "id" should have been updated.
2 - Since I am not a dev, is there a way to make my query easier to read ?
the onSuccess handler is passed the output data from triggering a query, so you can modify your function there to accept an argument d, or data, or whatever, and then parse fileId out of it:
i'll be honest i didn't execute this, i just linted it in VSCode, so it may not run, but sets you on the right track. i'm not a javascript developer either, and they are sometimes elitist about the flow of handlers, so take it as just a suggestion