November 18, 200322 yr 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.
November 18, 200322 yr Create an unstored calculation field in your database (I'll call it cRdm but the name is arbitrary) 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.
November 18, 200322 yr 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
November 18, 200322 yr Wow...both cool suggestions. I'd read this earlier and was wondering how best to go about this.
November 19, 200322 yr 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...
Create an account or sign in to comment