Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding "N" records

Featured Replies

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..

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

  • Author

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...

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?

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

  • Author

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!

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.