EddyB Posted May 13, 2003 Posted May 13, 2003 Hi all, I have a DB containing only about 700 records. I need to create a script that will do the following I enter some search criteria and perform the search this will bring back about 70 records on average. Then I run the script. It gives each found record a number starting at 1 and going up in increments of 1 for each record. It then generates x number of random numbers not greater in value than the current found count (x = 33% of currentFoundCount) The random numbers it has generated then relate to the records in the current found set with those numbers The field "Selected" is then set to "Yes" for these records The numbers are then removed from the original found set of records I'm a bit stuck with this one any help would be greatly appreciated! Thanks Ed
djgogi Posted May 14, 2003 Posted May 14, 2003 Before performing the find Find All go To Layout [layout with field selected on it] Replace [selected, "No"] Your find criteria After performing find, supposing you have defined an field gRel and relationship SomePercentOfRecs:.gRel-->recNumber Set field [x,Int(Status(CurrentFoundSet)*33/100)] Set field [gCounter,x] freeze Window if[x] Loop Set fiield [gRel,int(random*x)] If[somePercentOfRecs::Selected="No"] Set Field [somePercentOfRecs::Selected, "yes"] Set field [gCounter,gCounter-1] end if exit loop if [gCounter=0] Enter Find Mode[] Set field [selected, "No"] Perform Find [Constrain Found Set] //Handle new found set end if Dj
EddyB Posted May 14, 2003 Author Posted May 14, 2003 Hi Dj, I've not tried this yet but reading through I'm liking this! Thanks for replying, I'll give it a whirl! Ed.
Recommended Posts
This topic is 7851 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 accountSign in
Already have an account? Sign in here.
Sign In Now