May 13, 200322 yr 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
May 14, 200322 yr 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
May 14, 200322 yr Author 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.
Create an account or sign in to comment