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.

Featured Replies

I have a list of 1000 potential jurors. I need to be able to select, say 100, random jurors and put them into a separate database. Eventually, the unused jurors will return to the 1000 potential jurors. I have tried using RANDOM but the Random field must be able to be recalculated at will and also I can't get it to create unique integers.

(Geaorge, I sorry. Ididn't explain myself very well.)

You can use the following formula to create random numbers between 1 and 1000 in a calculation:

Round(Random*1000, 0)

The next thing to to would be to use this number to select a potential juror (by ID number I'm assuming) to be added to your new database. Make the ID unique so that you can compare the data (such as a concantenation between the random number and a social security number or other unique data - "136-892-34-2902" etc.

You could then use another sub-routine to compare the potential juror with those already added to your database.

Perhaps the best way would be to set up a relationship between the two files (using the selection date or something like that) so that you can use a global field from the first database in a sub-script nested in the second database. You could use a global field like PotentialJuror in the first database and a Loop sub-script to compare the potential juror to all those selected and add it if it was unique. You could also use copy-paste without having to set up a relationship.

  • Author

Thanks for the help. I think I can get it now. The concatenation idea really helped. I modified the Round(Random*1000, 0)formula to make sure there wasn't a 0. Now its just a matter of finishing the last 2 paragraphs.

Again, Thanks.

quote:

Originally posted by TyGuy:

You can use the following formula to create random numbers between 1 and 1000 in a calculation:

Round(Random*1000, 0)

The next thing to to would be to use this number to select a potential juror (by ID number I'm assuming) to be added to your new database. Make the ID unique so that you can compare the data (such as a concantenation between the random number and a social security number or other unique data - "136-892-34-2902" etc.

You could then use another sub-routine to compare the potential juror with those already added to your database.

Perhaps the best way would be to set up a relationship between the two files (using the selection date or something like that) so that you can use a global field from the first database in a sub-script nested in the second database. You could use a global field like PotentialJuror in the first database and a Loop sub-script to compare the potential juror to all those selected and add it if it was unique. You could also use copy-paste without having to set up a relationship.

  • Newbies

Here's another approach.

1.)Add a number field to the database. Call it "Selected".

2.)Add a global number field. Call it gRandom

Add a summary field. Call it Total Selected. Sum(Selected)

3.)Write the following script:

Loop

Set field ["gRandom", "Round(Random * 1000 +1, 0)"]

Go to Record/Request/Page "gRandom"

Set Field ["Selected", 1]

End Loop If(Total Selected = 100)

End Loop

Run this script. It will find 100 random records, mark each one with a "1". The summary field will keep count and cause the script to exit after 100 entries (no duplicates this way).

Next, just export these records to a text file or import from your other database.

  • Author

It worked like a charm. Thanks for the help and the education. I have used Alpha4 and the old DB3. FMP is just another learning curve.

Again, thanks for the help.

quote:

Originally posted by Nearo:

Here's another approach.

1.)Add a number field to the database. Call it "Selected".

2.)Add a global number field. Call it gRandom

Add a summary field. Call it Total Selected. Sum(Selected)

3.)Write the following script:

Loop

Set field ["gRandom", "Round(Random * 1000 +1, 0)"]

Go to Record/Request/Page "gRandom"

Set Field ["Selected", 1]

End Loop If(Total Selected = 100)

End Loop

Run this script. It will find 100 random records, mark each one with a "1". The summary field will keep count and cause the script to exit after 100 entries (no duplicates this way).

Next, just export these records to a text file or import from your other database.

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.