Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

AllWordCombinations (theWords)

Rate this function:  

  Average rating: 4.1  (33 votes)
  Discuss this Custom Function

Michael E. Kupietz, Michael E. Kupietz, FileMaker Consultant

List all possible subsets from a string of words

Sample Input:
AllWordCombinations("boy girl cat dog")
Sample Output:
boy girl
boy girl cat
boy girl dog
boy girl cat dog
boy cat
boy dog
boy cat dog
girl cat
girl dog
girl cat dog
cat dog

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed


Given a string of words separated by spaces, this function returns a list of every unique combination of one or more of those words. For instance, AllWordCombinations("boy girl cat dog") will return:

boy girl
boy girl cat
boy girl dog
boy girl cat dog
boy cat
boy dog
boy cat dog
girl cat
girl dog
girl cat dog
cat dog"

Please note: this returns all combination, not all permutations. "Boy cat" and "Cat boy" are two different permutations, but the same combination. A fruit salad made of apples and grapes is the same as a fruit salad made of grapes and apples.

Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it


5 most recent comments | Show all 8 comments

Thanks. That's what i did. (boy1, boy2) I asked in the way to understand the programmation.

In the same way, is there a way to limit the number of combinations ?
For example : For 10 elements only the combinations of 5 or less.

Thomas, Paris
December 11, 2015 10:27am

Thomas, off the top of my head, I'm sure there is. Off the top of my head, before you call the function recursively from within itself, you could just do a wordcount() on the value you're about to call it on, and if it's reached maximum length, don't make the recursive call.

Michael E. Kupietz, FileMaker Consultant, San Francisco, CA
September 29, 2016 5:46pm

Great function, has really come in handy for me. Thanks! I'm wondering if there's any way to support characters like dashes and slashes and underscores in the words. I tried changing the functions from WordCount, LeftWords, RightWords to ValueCount, LeftValues, and RightValues, but all I get is a single line of text with each of the words. I'm using this to build a record tagging feature and would like to be able to support characters like - / and $ in my tags. Thanks!

Rob, Nevada
April 09, 2017 4:37pm

Well, this is a kludge, but off the top of my head the very easiest thing to do would be to run the input string through a substitute function before passing it to the custom function, and change those characters to letter strings unlikely to be used elsewhere. For instance:


so they become embedded as text into the surrounding words ("tag1-subtag1" becomes "tag1XYZABCDASHXYZABCsubtag1") and treated as single words by the function. Then just do the reverse substitution on the output of the function to replace those strings with the original punctuation.

Glad you're finding it useful, thanks!

Michael E. Kupietz, FileMaker Consultant, San Francisco, CA
April 09, 2017 9:26pm

Oops, there shouldn't have been a space in "XYZABCSLASHXYZABC", above.

Michael E. Kupietz, FileMaker Consultant, San Francisco, CA
April 09, 2017 10:21pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 1 + 3 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. sql.getTable ( fullyQualifiedFieldObject )
  (Thu, Feb 22, 8:36am)
2. sql.getField ( fullyQualifiedFieldObject )
  (Thu, Feb 22, 8:34am)
3. FilterOut ( ListA ; ListB )
  (Wed, Feb 21, 6:11pm)
4. Char0 ( )
  (Sun, Feb 18, 2:35am)
5. CreateVCardFile ( FirstName ; LastName ; CompanyName ; Phone ; Email ; WEB ; hAddress1 ; hAddress2 ; hZip ; hCity ; hCountry ; wAddress1 ; wAddress2 ; wZip ; wCity%2
  (Sun, Feb 18, 1:50am)
6. AccurateAge (start; end )
  (Tue, Feb 13, 5:41am)
7. fnParser_UnCertain(text;firstSymbol;secondSymbol;SN)
  (Mon, Feb 12, 11:10pm)
8. sql.whereInList.asList ( fqFieldToReturn ; fqFieldToMatch ; listOfValuesToMatch )
  (Wed, Feb 07, 2:03pm)

RSS Feed of Custom Functions