An index by definition:
An option that can be enabled when defining (or changing) the definition of a field. When indexing is enabled, FileMaker Pro builds a list of all the values that occur in the field in the table. This improves the performance of tasks such as finding data, but it increases the size of the database file on disk.
Thus you can't use filemaker's native indexing for this.
You CAN use ExecuteSQL to return this IF you know the parameters of your found set. IE:
....found set parameters....
Brian Dunning's site also has a custom function (http://www.briandunning.com/cf/1093) that assembles the values of a field across a found set into a return-delimited list. Might be what you need.
If your found set will potentially be more than say 1000 records, then definitely look at the Modular FileMaker site hosted by Todd Geist. The module you want is called HyperList. I just went to the site to grab the URL below and see that this was just updated a few days ago saying it is now 2-3 times faster! I have used it on found sets of 20,000+ records and it only took 3-4 seconds. If you tried that with the custom function, it would either choke or take minutes.
As soon as I send this, I am going to go back to the web site to find out what they did to speed it up that much!
Mike: you're not mentioning value lists using the show only related values option. If you collect the record ID values for the set you could create a relation that stores them in a global. Then you could get the unique related values.
Very cool, Doug. Will definitely check it out. Thanks.