Updating table with checkbox not working

I am trying to update a checkbox when I click on it but it is not working.

Here is my update query:

UPDATE operators
SET prime = {{tableOperators.selectedRow.prime}}
WHERE id = {{tableOperators.selectedRow.id}}

Here is my setup:

What am I doing wrong?

Hi @Shawn_Optipath,

When you say it is not working, what do you mean? Does it mean the changeset remains?

I think you're almost there. Your update query should be working.

  • Have you added a success event handler to your query to run trigger the query which is the data source for the table?
  • On the Save actions, click on "clear changeset on successful save".

I think this should do it.

Almost there :slight_smile:

I chankged my query to:

UPDATE operators
SET prime = {{tableOperators.changesetArray[0].prime}}
WHERE id = {{tableOperators.changesetArray[0].id}}

Then on success I added

Instead of the save add on I added an event handler:

The problem now is that the query is in an infinite loop. I am assuming it is being triggered every time the data is updated. Any ideas?

@Shawn_Optipath You can try and set the query to run periodically in the advanced settings

Can you send a screenshot of your table event handler to trigger the update query? the two screenshots are identical.

Your data source query shouldn't be triggering your update query, make sure your event handlers for the former are correctly set up.

So my suggestion would be:

  • Make sure your update query is set up to run manually and not automatically (this could be triggering it as when the data refreshes, changesetArray would change and therefore triggering yoru update query)
  • Add the clear Changeset handler to the query with your data source instead of your update query
  • I find the GUI very helpful for these kind of operations, e.g. :

Hope that makes sense

HI @MiguelOrtiz,
You were right, I had the query running automatically. The loop went away when I changed it to manual.

Here is the final query. On success it runs the table query, then clear changeset.

UPDATE operators
SET prime = {{tableOperators.changesetArray[0].prime}}
WHERE id = {{tableOperators.changesetArray[0].id}}
1 Like