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!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will LovingPresident, Dedication Technologies, Inc.Commented:
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:


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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
_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?
Will LovingPresident, Dedication Technologies, Inc.Commented:
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.
_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.
_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!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.