computer icon MYOD - Make Your Own Database - a tutorial
by Cindy O'Hora



Define Fields

Radio buttons

Pop-up Menu


Value List




Grand Summary

Sort & Page view

Data Entry


Loverly Layout

New View


Find by date

Calculating Radio Buttons

Importing one database into another

Database Ideas

Database in class

Database Graduation Project

Databases for kids

Other DB activities

Database Quiz

Database Hunt

Database Vocabulary

Using databases

Database tips index

Radio Buttons and Calculations

If you elect to use a radio button to collect data, you are confronted with a bit of a challenge. Suppose you want to calculate using the collected data? You must first convert the button's choice to a numeric value that can then be used in a calculation.

When we first discussed radio button fields, I used the example of gender female-male. There are other uses. For this example, I'll use a wedding reception.

The radio button of this wedding database offers a choice of entreé. You could use Find to determine the number of guests selecting each choice.

You can also use summary fields to automatically add up all the choices. This is going to be a two step process. First, you must convert the button field's data to a number. In the second step, we'll use summary fields to add all the numbers. I'll show you how to do this for one choice. You'll need to repeat the process for the other choice in the button field.

For the purposes of this lesson we have a database which has a button field called entreé.
It offers two choices cornish hen or ham.

How To:

1. Open the database.

2. Go Layout ... Define Fields.

3. In the Define Field's Name box enter conhen.

4. Change the Field Type to Calculation.

5. Click Create. This will open a Formula dialog box.

6. In the formula box, enter IF(NUMTOTEXT('entree')="cornish hen",1,0)

7. Click Okay. The new field is added to your database.

Repeat this process to create another conversion calculation field for ham

1. In the Field name box enter conham.

2. Change the Field Type to Calculation.

3. Click Create. This will open the Formula dialog box.

4. In the formula box, enter IF(NUMTOTEXT('entree')="ham",1,0)

5. Click Okay. Click Done.

Look at your database. You'll see the two new fields are added. They should have either a 1 or 0 in each record depending on the choice made in the radio button.

Adding it up
Calculation fields do their ciphering work within an individual record. To add things up across more than 1 record you use a Summary field. I'll show you how to do this for the cornish hens. You repeat the process making the appropriate changes for ham.

1.Go Layout ... Define Fields.

2. In the Field name box type Total hen.

3. Change the Field Type to Summary.

4. Click Create. This will open a Formula dialog box.

5. In the formula box enter SUM('conhen')

6. Click Okay. Click Done.

Hey, I don't see anything! That is a common confusion with summary fields.
Now you must add it to a Grand Summary.

1. Go Layout ... Layout

2. Go Layout ... Insert Part.

3. Choose Trailing Grand Summary.

4. Click OK. You'll see that now there is an additional line added to the bottom of the database and it is labeled Grand Summary.

5. Go Layout ... Insert Field.

6. Select Total hen in the list.

7. Click Insert. You should be looking at the database in Layout. The field Total hen is now visible.

8. Drag it down into the area below the Body line, but above the Grand Summary line.


9. Go Layout ... Browse.

10. Sort the database using the entreé radio button as the sorting criteria.

11. Go Window ... Page view.

12. Scroll to the last record. Just below it, you will see the total for hens.

You must be in Page View to see the Grand Summary data. Feel free to switch back to non Page view. You only need to be there to check the results.

* Suppose your SUM is currency. You'll notice that results are not given in currency format. Change the fomatting of the field to currency. Go: Layout .. Layout. Double click on the box for the total. In the format dialog box select currency..Save

number format box


Other examples of radio button calculations?

  • Course selection - Monday or Wednesday.
  • Fund raiser - T shirt colors blue or grey.
  • Bunks - Top or Bottom
  • Morning or afternoon session

Database Internet Hunt

Harnessing Databases

Harnessing online databases 2

Database Activity - vocabulary

Database - organizing AppleWorks database tips

Internet Hunts / Nature / Computers / Puzzles & Projects / Site map / Home

All trademarks, copyright and logos belong to their respective owners.

Copyright 3/2004 Cynthia O'Hora All Rights Reserved. Posted 3/2004 by Cindy O'Hora