You can use Radio Buttons with logic and rules to gather an average or rating of an inspection or feedback form. In this example, there will be 3 radio buttons that will have rating values 5-1, 5 being the highest. The user will select a number depending on their assessment of each Radio Button category (Quality, Safety, and Cleanliness). After selecting a rating value in each of the 3 Radio Buttons, an overall rating will appear in a textbox as an average of the radio button results.
HOW TO CALCULATE AN AVERAGE VALUE
Note: You don’t necessarily have to use radio buttons for this kind of calculation, this is just an example.
Step 1. Add a Radio Button and Textbox controls into your form.
In the left pane of the form creator, under Basic controls, you will find Radio Button.
After adding a Radio Button into your form, select it to view the control’s properties. Here you can change the label name, customize the layout of the buttons, and edit the values under Items. For this example, I changed the Label, the Layout to Horizontal, and used a Custom list.
Select the EDIT ITEMS button to edit the values of the Radio Button. I simply changed both the Display Name and Field Value to 5 through 1.
Hint: After finishing your first Radio Button, you can use the Duplicate button to copy the Radio Button to avoid having to edit the values and layout for each control. However, you may want to change the label name of the duplicated buttons if needed. Keep in mind we will be adding rules to these controls, so you may want to wait until after you finish the 1st rule on a control before you make duplicates. This way, you won’t have to add a rule to each of the copied controls, it will be there automatically when the control is duplicated. I copied the 1st Radio Button twice, since the Properties and the Logic are duplicated, I simply needed to change the labels of the 2nd and 3rd Radio Buttons.
Once you’re done with your Radio Buttons, add a Textbox which will contain the calculated average of the radio buttons. All you need to do for now is change the label to something that fits your scenario.
Note: I also changed the field names of the controls. This will help me organize and keep track of my controls when adding rules and logic.
Step 2. Add Logic
Each Radio Button control needs a rule to tell the Textbox what to do with the selected values. This rule will simply take each selected value (5-1), and divide it by the number of Radio Buttons (3) to get the average.
For all 3 Radio Buttons, do the following:
Select the Radio Button control to see the Logic option in the left pane
Select the NEW RULE button
In the screenshot below, under DO THIS: In the Action drop down choose Set another field’s value. For the Set value of drop-down, select the textbox which will contain the final average value (In my example, the rating field). Then insert a formula that will add all 3 Radio Buttons, and divide them by 3. It will look something like this:
(../quality + ../safety + ../cleanliness) div number(3)
After completing the rule, SAVE & PUBLISH your form and try it out on your device. Once all values in the Radio Buttons are selected, an average value will appear in the average rating Textbox as show below on the device.