Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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


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

Recommended Posts

Posted

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.

Posted

Try this:

Show All Records

Omit Multiple Records[]

Show Omitted Only

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

--sd

Posted

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.

Posted

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

Posted

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

Posted

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

This topic is 5343 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.