Using checkbox to update existing boolean (yes/no)

Hi all, I am currently working to make use of a checkbox to update an existing boolean in my database table.

I used the below link to create the checkboxes

https://support.knack.com/hc/en-us/community/posts/222365967-Update-multiple-records-with-a-checkbox

Link below is my current code

https://pastebin.com/hf6L2d0J

My goal is that when i check the checkbox, the 'selection' boolean is set to 'yes', if it is unchecked, the 'selection' boolean is set to 'no'. However, I have no idea where to implement it in the above code.

Do reply if you need access to the app to aid me further or if you have a solution.

Thank you in advance.