December 2, 200322 yr I'm not sure this is possible given the limitation of the FindAny CDML tag but here's what I want to do... I want to pull a random record from the database but want to include specific criteria about which records to be chosen. Anyone know if this is possible? Or does anyone know another way other than to use -FindAny?
December 3, 200322 yr It's not really a random record then, is it? Probably what you need to do is perform a -Find for the records you want based on the criteria, then sort them randomly (create an unstored calc field that uses the Random function) and return the first record to the user.
December 5, 200322 yr LOL @ Vaughan if u look at your criteria as = category then u can use Vaughan's approach. so eg. pull all the records CATEGORY="shoes" but do NOT sort them by shoe size....is one way of looking at "random record in an ordered group" I guess it depends what aspect of a record is to be taken as random (eg. unsorted shoe: size,color,brand name etc.) Take it away....
Create an account or sign in to comment