April 6, 201015 yr 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.
April 7, 201015 yr Try this: Show All Records Omit Multiple Records[] Show Omitted Only Here would you be prompted for the N to show... --sd
April 7, 201015 yr 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. 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.
April 7, 201015 yr 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
April 7, 201015 yr 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
April 7, 201015 yr 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