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

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

Recommended Posts

Posted

Can anyone advise how to find a random 10% of my database for purposes of conducting a survey? I have 9800 records, each with an individual number. I need to select 10% at random.

Posted

Create an unstored calculation field in your database (I'll call it cRdm but the name is arbitrary):P

cRdm = Random

Make sure it's unstored, and the result type is set to number.

Then create this script:

Show all Records

Sort [by field cRdm]

Loop

Exit Loop If [status(CurrentFoundCount) <= (Status(CurrentRecordCount) / 10)]

Omit Record

End Loop

Every time you sort the database it'll sort differently (because the Random calculation will change each time because it's unstored). The loop then omits the unwanted records.

I haven't tested this but it should work.

Posted

Rather than omit 90% of the records, why not omit 10% and then do a Show Omitted? Should be quicker.

Show all Records

Sort [by field cRdm]

Loop

Exit Loop If [status(CurrentFoundCount) <= (Status(CurrentRecordCount) *.9)]

Omit Record

End Loop

Show Omitted

Posted

I guess without the loop, it will be even quicker.

g_Percent (global number- Enter your percentage here)

cRdm =Random

SetField[g_Percent =Int(Status(CurrentRecordCount)*(g_Percent/100) )+1)]

Show all Records

Sort [by field cRdm]

GoToRecord[by Field Value - g_Percent]

OmitNext[500000-no dialog] *

Put here one of these number of records you won't never have in your file...

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