Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6794 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have the need to pull only the first 5 instances of a database based on a keycode.

For instance, the database is approx 75,000 records, there are 12 different keycodes. I'd like to pull the first 5 occurances of each keycode and export to a separate file. (a Sample data file for lack of a better term)..

Before I go struggling with this, I thought I'd ask.

Thanks for any help that can be offered..

Posted

Before *I* go struggling with this, I thought I'd ask: which 5?

It could be *any* five or the first 5 - I don't think it matters.. It's for producing live samples of jobs that are printed.

Thanks...

Posted (edited)

Here's a script hat picks the first 5 records of each code. It's not going to be terribly fast so you may want to continue working with comment. Comment is trying to better understand your needs so he can give you the correct advice.

KeyCodes.fp7.zip

Edited by Guest
Posted

When you mention a sample, it implies a random choice. If not randomized, you will ALWAYS get the SAME first 5 - is that what you want?

It is usually a one-time sampling of the data. When a mailing is done, sometimes the database is flagged with a field that indicates they wish to receive a that record as a sample..

Most time, there are no such flags. So, if there was a STATE field, lets say, and they want 5 samples of each state - it would result in a total of 250 records. Those 250 would be exported and place in a print stream for the samples. The original records would remain for the final print run.

Randomization should not matter, but if it did, I would assume that wouldn't be that hard...

Thanks for your perserverence!

Posted

I'm not sure if that means yes or no... Anyway, the attached draws a random sample by category. If you're willing to settle for the first n records of each category, change the script's sort order to Category only and delete the cRandom field - this will make it run faster.

RandomSample.fp7.zip

This topic is 6794 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.