April 28, 200421 yr I know there is a function in filemaker to generate a random number. Has anyone successfully applied this to make a script to go to a random record? All our records obviously have an id in the format II#xxxxxx where x is an updating serial number. Any ideas? Thanks
April 28, 200421 yr I think this will work: Set Field [ gRandomTemp , Round(Status(CurrentRecordCount) * Random, 0) ] Go to Record/Request/Page [ gRandomTemp ]
April 29, 200421 yr If you have a copy of "Scriptology" there is a file called RandomPicks.fp3, on the companion CD, which chooses random records using a different technique.
May 14, 200421 yr There's a slight flaw in Ender's formula which will give a skewed distribution. The last record will only have half the chance of being picked that the other records have. Also, there is a chance the formula will return a zero value, and there is no corresponding record zero. To give a fair distribution, the round function should be replaced with Int as follows: Set Field [ gRandomTemp , Int(Status(CurrentRecordCount) * Random)+1 ] Go to Record/Request/Page [ gRandomTemp ]
May 14, 200421 yr Author Ah right OK - excellent thanks!! Not that it really matters with 80,000+ records! Thanks
May 15, 200421 yr Hi, folks! IMO BobWeaver is among the top experts at FMFORUMS and personally, I am glad for his input and corrections -- and especially his explanations when he is generous enough to provide them. He's one of the reasons FMFORUMS is so helpful to so many of us. I can think of many scenarios where not having a truly random (ha! truly random!) solution could be problematic and raise issues of liability. What if FMFORUMS randomized the ad banners w/an inaccurate function and an unhappy customer wondered why his/her banner was not showing up as much as other advertisers? Uh.. ooopss.. sorry, Stephen, maybe we shouldn't go there, eh? Anyway, you get my point, eh? So, thanx, Bob! Keep us honest and keep FMFORUMS creditable! --ST
Create an account or sign in to comment