Change setting based on selection

I have a form that lets the user either toggle a switch OR choose from a list. I’d like it to force the switch to OFF if the user makes a selection from the list. And I’d like it to clear selections from the list if the switch is flipped ON.

I thought I had a solution by using visibility settings to hide the list if the switch was ON or hide the switch if a list item was selected. But of course that doesn’t clear the selections so I end up with input that includes both a TRUE from the switch and selected items from the list.

Any suggestions?

I found a solution that works but maybe there’s a better way.

I added a button that appears only if items in the list are selected. The button clears the list, sets the switch to TRUE, and hides the list.

I added another button that appears only it the switch is on. The button sets the switch to FALSE and makes the list visible.

Screen Shot 2022-11-03 at 1.14.07 PM
Screen Shot 2022-11-03 at 1.14.16 PM