How to calculate a value depending on the selection of a radio button widget