A key question: do you have multiple checkboxes for a single field? This can make a difference in how you do this.
There are quite a few different methods you can use for this.
- You can set the number field to look up the value from a related table--useful if the value entered may change in the future such as if this is a purchase price for an item.
- The number field can be a field from a related table placed on your layout with the relationship based on the value or values in your checkbox field. Similar to option 1, but changes in the related table automatically appear in all existing records on your main layout.
- You can create a calculation field that returns the desired value based on the value or values selected in the checkbox field--result is read only.
- You can set up an auto-entered calculation that puts 60 into the field when the box is clicked--this allows people to edit the 60 into something else if that is needed.
The exact details for implementing any of these depend on what you want to do and how your check box field is configured.
I think what im looking for is what you described in 4.
What exact steps would I go though for that?
Depends on whether you have just one check box or several defined for your checkbox field.
Assuming a single value:
- Find the definition for your number field in Manage | Database | fields and double click it.
- Select the auto-enter tab, select the by calculation option and enter: If ( Not IsEmpty ( CheckBoxField ) ; 60 ; Self )
- Click OK, and decide whether or not to clear the "do not replace existing value..." option.
If you clear it, the field will always read 60 if the check box is selected, to enter a different value, you have to clear the checkbox field first. If you don't clear it, clicking the checkbox after a value has been entered into the number field won't change the contents of the number field.
If you have multiple check boxes, the auto-enter expression gets more complex.
I do have more than one, how much more complex is it?
you are being a huge help btw I cant thank you enough
We just have to add a different function to check and see if the right value was selected.
If ( Not IsEmpty ( FilterValues ( CheckboxField ; "YourValueHere" ) ) ; 60 ; self )
This approach ignores all other values that might be selected by clicking a different check box.
If you need to enter different numbers for different values then we'll need to modify this even further, perhaps with a Case function instead of IF.
Do I need a different checkbox field? because I added it however no matter which I select it says 60
As written, the expression enters 60 if you select the value you've designated for this. If you select a different value, the number in the field will remain unchanged. THus, if you select the first value, you'll see 60 appear in the field. If you then click a different check box, you'll still see 60 in the field as the field will now remain unchanged.
I think you should describe each checkbox in your field and what you want to see appear in this number field when each checkbox is clicked. Of particular importance: what do you want to see happen if a combination of check box values are selected?
well in this particular case it is one of two choices, either single (desired result being 60) or couple (desired result being 50)
however I have a similar problem where I want the number of boxes selected out of 12 to be shown in a field below.
I'd make that first field a radio button set rather than check boxes since selecting both single and couple would not make sense.
With radio buttons, you could simply use:
If ( checkboxfield = "single" ; 60 ; 50 )
or use the looked up value method I previously mentioned to copy these values in from another table so that if you want to change the values in the future you can do so more easily than you can with this method.
If you really want check boxes, you can use this method:
Case ( Not IsEmpty ( FilterValues ( CheckboxField ; "Single" ) ) ; 60 ;
Not IsEmpty ( FilterValues ( CheckboxField ; "Couple" ) ) ; 50 ;
To count the number of selected boxes in a field, you can put this in a calculation field: ValueCount ( YourfieldnameHere )
both of those options, no matter which I selected displayed 50
We're missing some key detail. Are both fields defined in the same table?
Here's a demo file you can download and compare to yours to see if you can spot anything: http://www.4shared.com/file/5kF1lqT8/CheckBoxEnumeration.html
Your file is locked with an account name and password.
ok after playing with it for several hours I got it to do what I want. One further question, is it possible for the people who selected certain boxes (i.e. the list of 12 that we counted) to go onto a list on a separate layout?