Update in Postgres DB won´t work

I have a problem with my update trigger. (shown as followed)


It has no problem updating the second and third column as it is an insert from retool but the first and fourth column wont update. The first column is through a dropdown(tag) and the fourth is a simple text insert through the table (double click on row). I already tried to change the Changeset to {{Bewertung.selectedRow.data.bewertung}} etc. but it light up red.

Do I have something wrong in my syntax? I would apreciate any help.

What do each of the values render to when you hover over them before running the query? Is the date format correct ? etc...

Like I said the date works just fine. When I hover over the values it shows empty quotation marks.


It says that it updated an item when i change and save a row but it doesnt save it in the connected database.

Do you have the event handler set for the table as Save Changes and in it set it to Control the query you are displaying in the picture above?

Yes the event handler is set correct. I know this because the date and person who updated gets updated in the database. So the event handler and Query control work

{{yourTablename.changeSetArray}}

Thank you so much it worked.

The only problem now is that i want to change the save event handler, that it only triggers when the input for specific column changes.

image

What do I have to put in the only run when input?

Thanks for your help.

Sorry, are you saying you only want the Save Changes event handler to fire when something happens or another query to execute when a user selects a different row?

Hi @mp23,

You can wrap Javascript inside double curlies in this input ("Only run when"). The Javascript has to evaluate to true or false.

For example, if I wanted to ensure that a user only submits an update if the "created at" date is not after today, I could use something like:

{{table2.changesetArray.filter(x=>x.createdAt>moment().format()).length===0}}

If the Javascript evaluates to true in the green popup, the query will run

Another option is to use the Disable save input. In this case, it's a bit opposite. true means that it will be disabled and therefore the save query won't run.