There's no way to, as part of a find, limit the found set to the first X number of matching records. But you could easily use the Omit Mulitple... command in the Records menu after doing your search.

Here's a script to extract a range of our found set (assuming you're using FileMaker 7 or later, there would be a couple of extra steps in 6 or earlier):

Assuming you have two global number fields to define the start and end of your range, gStart and gEnd.

1. Go to Record/Request/Page "by calculation"; perform without dialog. Calculation is "gEnd + 1" 2. Omit Mulitple Records; perform without dialog. Specify the number of records to omit with the formula "Get(FoundCount) - gEnd"
3. Go to Record/Request/Page "First"; perform without dialog
4. Omit Mulitple Records; perform without dialog. Specify the number of records to omit with the formula "gStart - 1"

So if you want records 1-150 out of 1000 found, it goes to record 151, omits 850 records, goes to record 1, and omits zero records, leaving you with 1-150. If you want records 40-80, it goes to record 81, omits 920 records, goes to record 1 and omits 39, leaving you with 40-80.

If you always want to limit your found set to records 1 through X, then you can skip the last two steps. If you wanted to get the first 150, and then the next 150, and so on, you'll have to repeat the search and run the script with the new parameters each time.

Regards,
Chad



On Feb 12, 2007, at 8:58 AM, Landy Atkinson wrote:

I have a database of 5000+ addresses which can be grouped into 3 territories based upon state, Western, Central and Eastern. We want to send a mailing to about 150 in each region each month until the list is used up. {if we sent more, the sales people could not keep up with the follow-up activities.} I can easily perform a query to pull up a list of addresses in each region which have not received a mailing (I set up a Mailed field and a Mailed_Date field which will be filled in at each mailing), but I am not sure of a good way to limit the result list to the first 150 found so it can be used to print mailing labels and mark as Mailed.

Do I have to do this with a loop and counter in a script or is there a way to select records 1 to 150 (or for that matter 40 to 80, etc.) in the found set directly as part of the query or with another "limit" command. Seems like being able to pick a subset of a query to "display by page" would be a generally useful task that is complicated by having to use a script.

Any suggestions of how best to approach this are welcome.





***************
Chad Novotny
Vice President - Technology
The Support Group, Inc.
database design, development and training services
boston - los angeles - new york - san francisco - washington, dc

24 Prime Park Way
Natick, MA 01760
t: 508.653.8400 x217
f: 508.653.2830
[EMAIL PROTECTED]
www.supportgroup.com

Reply via email to