Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

random function

Status
Not open for further replies.

daveinuk

Technical User
Sep 2, 2005
72
DE
Hi All.
Is there a function in crystal 8.5 which generates a random record?

We have lots of records, and we want to check 10% of all the records at random for accuracy so we want a formula that will pick 10% of all records that meet the record selection.

Any ideas?

thanks.
David.
 
Create a formula:

rnd()

Add this to your detail section and then sort on it. Then go to the section expert->details->suppress->x+2 and enter:

recordnumber > .1 * count({table.field})

...where {table.field} is a recurring (non-null) field.

There is a FAQ on this, if you want to take a further look.

-LB
 
lbass,

Count({table.field}) will return the number of records in the report. If you conditionally suppress 90% of them as in your formula, that will return the first 10% based on recordnumber, not a random 10%. Or maybe I am missing something?

I also have a need for a random display, and am looking for a simpler way to do this.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Don,

The random formula will apply a random number to all records. Then when you sort by it, the first 10% by recordnumber will be a random selection from all records. I think Ido Millet has a FAQ on this, also.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top