There's a great function called Get Value: FileMaker Pro 15 Help . This will pull values from a list. It does what you've asked for here. For your NeedSupport 1 field, you'd use the calculation GetValue ( CheckBoxField ; 1), and so on.
Keep in mind a few things about check box fields:
1. The check box control adds the values they chose to the end of the list.
If the user selects "Legal" and then "Health" , it will look like this:
If the user unchecks Legal, that will disappear. If they recheck Legal, then it will look like this:
i'm not sure that matters in your case, but it is something to be aware of.
Another thing, the above calculation will return nothing if there's no value in that list position: GetValue (CheckBoxField; 3). If that's okay, then fine. Otherwise you may want to put an If statement around it with a default value (such as N/A) if there's no 3rd value checked. (the Let statement is used and is your great friend)
_Value = GetValue (YourTable::CheckboxField ; 3)
if (IsEmpty (_Value) ; "N/A" ; _Value)
This is saying if there's no 3rd value checked (isEmpty), return "N/A" otherwise, return the value of the 3rd checked)
Thank you very much for your help, now it is working.
Sorry but getvalue won't work here as the values are stored in the field in the order that the check boxes are clicked.
Use filtervalues instead;
Not ( is empty ( filtervalues ( checkboxfieldhere ; "legal problem" ) )
will evaluate as true if a check box value "legal problem" is selected.
It would be simpler to use separate fields with a single check box each. It would be more flexible to set up a related table where selecting an option creates a related record and deselecting deletes it.
Hmm. I'm not sure why you mention it doesn't work.
The demo file I put together shows it works.
As I understand the OP, he doesn't care what order they're checked, only that each calculated field captures the 1st, 2nd, 3rd values checked.
In the report I create calculation fields as below
1.Need support 1 (this is field will view the first checked item from the checkbox)
2.Need support 2(this is field will view the second checked item from the checkbox)
3.Need support 3 (this is field will view the third checked item from the checkbox)
And it seems the OP doesn't care about "legal problem" being checked, so filterValues doesn't help here.
Try this demo test:
Put a text field formatted with 3 checkbox values on a layout. Make a copy of it, but remove the check box formatting so that you can see the actual data in the field.
Create at least two records. On one record, click all three check boxes clicking the top check box first, then down to the next. On the second record, click the bottom check box firsts and go up.
Note which value appears in the edit box copy on each record.
Say you have these three values for your value list: Apple; Orange; Kiwi
Clicking top to bottom:
Checkboxes: Edit Box GetValue ( CheckboxField ; 1 ) returns "Apple"
Clicking bottom to top
Checkboxes: Edit Box GetValue ( CheckboxField ; 1 ) returns "Kiwi"
The order in which the user clicks the check boxes determines the order in which the values are stored in the field and so you can't reliably use the order to determine which value was selected. But in both cases, Not IsEmpty ( FilterValues ( CheckBoxField ; "Apple" ) ) will evaluate as True telling you that the Apple value was selected.
I get what you're saying, but I didn't read anywhere the OP needed his calc field 1 to return true only when "Apple" (in your example) is selected.
I in fact pointed out that which you pointed out as well.
It is my reading of OP that he just wants the first three values checked, in the order they are checked, not that he wants "Legal" in Calc field 1.
EDIT: Okay, the first sentence says OP wants a specific value from the checkbox field. But I used the description of each calculated field to give OP a formula. Admittedly, it is a bit confusing. So OP, either option will work depending on what you're looking for