Newbie question: updating a SQL table via a control in a repeatable

I have what I assume is a silly newbie question, but I can't seem to find the answer to it here or in the docs.

I'm basically building a simple to-do list: I have a SQL table (in Retool Database) with to-dos in it. From that I populate a ListView, where each element of the ListView is a Container with a text view (name column in the db) and checkbox (done column in the db).

When a user clicks the checkbox, I want to execute an UPDATE query in the database that sets the done column to true for the row in question.

For that to work, the change-event handler on the checkbox need to pass the primary key of the DB row that populated its container inside the repeatable to the UPDATE query. How do I do that?

Hey there @dfeldman,

You can use [i] (which refers to the index of your listview's component that triggers an event) to fetch the id you're looking for, e.g. {{ listView1.data[i].id }}

Here's a video I've created that may help you:

Let me know if you have any question!