Working with radio button values

What I’m trying to do:
I have a group of radio buttons with values 1,2,3.
The values are stored in a data table if selected.
As I have it if no radio button is selected the data table leaves a blank space where the value would go if it was 1,2 or3.
I would like the empty space in the table to be populated with 0.

This function gets the value

   
      add_selection1 = (self.radio_button_1.get_group_value())

and this calls the function that populates the table

anvil.server.call('log_hobbies_answer',add_selection1,add_selection2,add_selection3,add_selection4,add_selection5,add_selection6,
                       add_selection7,add_selection8,add_selection9)

I have been trying if statements but had no joy.
perhaps it would help if I new what the value was,for example True or False,so then I could say something like…
if add_selection1 == False:
add_selection == “0”

This will check if the value is true (1, 2, etc) and assign it to add_selection if it is, or fall back to the second value if it’s false (0, '', None, etc):

add_selection1 = (self.radio_button_1.get_group_value()) or 0

1 Like

Thank you very much Stefano
That does it