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.

Find only a certain number of records in the database regardless of the total number

Featured Replies

Hello

I am using ver. 10 advance of FMP. I would like to perform a find of only 1k records of a database of over 70K. If possible, I would prefer not to hard code the number but prompt the user for a number to enter. Thanks in advance for any help.

Just any 1000 records? Not 1000 records with specific criteria?

Try this:

Show All Records

Omit Multiple Records[]

Show Omitted Only

Here would you be prompted for the N to show...

--sd

wow.. thanks Soren i learned something.. except.. what practical use is that?

The practical use is providing 1,000 records (during the omit) and then showing omitted, leaving a 1,000 records in your found set.

I like it, Søren! However, if you are on the last record, you can't omit 1,000. You might Go To Record/Request/Page [ First ] after Show All Records but then it wouldn't be random; they would all be old records. You could Go To Record/Request/Page [ by calculaton ; Get ( TotalRecordCount ) - 1,000 ] but neither then would it be random because it would be the newest records. :laugh2:

Caution should also be used when using 'Show Omitted' since it can include a record created by another user, thus throwing off the constraint. I would rather suggest omitting all records except the 1000.

Regardless, I like the alternative use, leaving Omit Multiple[] available for the User to specify.

It's indeed a strangely looking requirement, but what if it's the need to create a series of new records in another table... from a centralized point, without going to a new layout.

Not that I think it's the way to pre populate at all, but it's perhaps a little difficult to understand the relational approaches behind this:

http://fmforums.com/forum/showtopic.php?tid/176396/post/204083/hl//fromsearch/1/

...as well as this:

http://www.fmforums.com/forum/showpost.php?post/149069/

...however have I made a tiny script to show how prepopulate a fixed number of records.

--sd

makeSets.zip

If you want to select 1000 random records from the table, you could try the following

Set Variable[$Nvalue; Value:1000]

Set Variable[$numberSelected; Value:0]

Show All Records

If [$Nvalue > Get(FoundCount)]

Show Custom Dialog [ "Error Message"; "The number of records I am to select is greater than the number available."]

Exit Script []

End If

Loop

Go to Record/Request/Page [No dialog; Int(Random * Get(FoundCount) + 1)]

Set Variable [$numberSelected; Value:$numberSelected + 1]

Omit Record

Exit Loop If [$numberSelected ≥ $Nvalue]

End Loop

Show Omitted Only

Not that the assignment of values takes a lot of time, but why not use statusfunctions when they're loaded anyway?


Show All Records 

Set Variable [ $howmany; Value:Get ( FoundCount )-100 ] 

If [ Abs ( $howmany ) = $howmany ]

     Loop 

         Go to Record/Request/Page [ Int(Random * Get ( FoundCount ) + 1) ][ No dialog ]

          Omit Record

          Exit Loop If [ Get ( FoundCount ) = $howmany ] 

      End Loop

      Show Omitted Only

End If

--sd

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.