Display results of a checkbox set

I'm pretty new to FM and I am having trouble finding a clear way to display the results that I need. I have a table that has a field using checkboxes.

I need to be able to sort my results based on just one of the checkbox values selected. What's the best way to set this up? It seems fairly straight-forward but I haven't been able to find a solution that I can make work. Thank you so much for any help!
_Astrid_Asked:
Who is Participating?
 
Will LovingPresidentCommented:
When you initially check a value in a Checkbox field, it enters the value in the field. Check another value and it gets added along with a carriage return after the first value. Each checked value is entered into the field in the order that it is checked in the list, so if your value list for the checkbox field called FavoriteFruit is: __ Apple  __ Banana  __ Cherry  __ Peach  __ Strawberry  and you check Peach, Strawberry and Apple in that order, the contents of the field - if you change it from Checkbox to Edit Box - will be:

Peach
Strawberry
Apple

with a carriage return separating each value. In FileMaker terminology, this is called a "List", a return-separated list of values.

That said, it's unclear what you mean by "Sort my results based on just one of the checkbox values." Do you mean sort the records into two groups based on whether or not that particular value is present? One way to do that would be to make a "Flag" calculation field that has a value of 1 if the particular value is present. Using my fruit list above, I might test to see if the value "Peach" is checked.

PeachFlag = Case( FilterValues( FavoriteFruit ; "Peach" ) ; 1 )

You can then sort by the PeachFlag field using a Descending Sort and all records that have "Peach" checked will sort first.

The FilterValues( ) function takes a list of values, in this case my checkbox field called FavoriteFruit, and looks for the value in the second part of the function, namely "Peach". If FilterValues( ) returns anything, meaning that "Peach" is in the list, then the calculation returns a 1 (it's boolean, meaning just true or false, 1 or 0).

Filter Values function: http://www.filemaker.com/help/html/func_ref3.33.49.html
0
 
_Astrid_Author Commented:
Thank you so much! I was able to sort my records with the specific value that I needed sorting first.

Is it possible to hide or not include the records that do not have the specific value I am sorting for? Basically, I have a contact in one table with a set of checkboxes that are checked through different phases of analysis of the contact. I need to be able to sort based on one of those phases that are checked off and I'd like to return only records showing that particular phase.

Perhaps checkboxes are not the best option to handle that kind of search?
0
 
Will LovingPresidentCommented:
If you are only searching for one checkbox value, you can just go into Find Mode, check the checkbox for the value you want to locate and then click Perform Find. Only records with that value checked will be returned. But perhaps I'm not following you...

This could also be scripted to perform the Find and then sort the results by whatever criteria you wish to see but that's probably a separate question, especially if you're new to scripting.
0
 
_Astrid_Author Commented:
Thanks again, Will. I will go ahead and post a separate question regarding the scripting to automate the Find for the results I'm looking for.
0
 
_Astrid_Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for _Astrid_'s comment #a40711691

for the following reason:

Very helpful and excellent response time! Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.