Button to Set a Boolean column to True

Morning

I am trying to find a way to set a column in a table to "true". The table (From_SQL) is populating from a retool database table and then I have added a new boolean field directly in the table (From_SQL) called "Selected".

I am trying to add a Button that I am calling "Select All Vessels" that I want to use to toggle the "Selected" column from false to true.

Is there a way to do this?

I was truing to do this by setting the following but I am unable to select the Column I want to adjust

Thoughts?

If you make the column type Boolean and set it to be editable, you can click the column to set it to true and then configure a save event to update the database. Does that not work for your use case? I'm not certain if the button is updating multiple rows from your description.
image

Yes to set them one at a time but I am looking for a way to set all the rows at the same time. Is there a way to do that

Sure - initial setup for example:
image

Once the rows I want to change are selected (picked one that is already true as well):
image

I click the button, it triggers the following code to set the value of the bool_test field:

let foo = table5.selectedSourceRows
let updatedData = foo.map(obj => {
  return {
    'id': obj.id,
    'bool_test': true
  };
});

return updatedData

The code block triggers an update query on success:

The update query triggers clearSelection() for the table and refreshes the source data:

Which shows the three selected rows are all true (no change to the second row, but didn't mess it up either) and didn't touch the other two rows:
image