Get a random record

Get a random record

With the introduction of randomNumber() fetching a random record is as easy as:
  1. //fetch records
  2. myRecord = My_Form[ID != 0];
  3. //check if records exist
  4. if myRecord.count() > 0
  5. {
  6.       //get ID list
  7.       idList = myRecord.ID.getall();
  8.       //fetch random record
  9.       randomRecord = My_Form[ID = idList.get(randomNumber(idList.size() -1))];
  10. }