If you need to randomly select and display a given number of records, or a user-specified proportion of the records, here's a simple approach:
Step 1:
Place the following formula (@Random_Number)
in the detail section:
---------------
Rnd()
---------------
Step 2:
Sort the records by @Random_Number (ascending).
Step 3:
In the suppress attribute of the detail section enter the following expression:
3.1 If you need to display a given number of Records:
---------------------------------------- RecordNumber > {?Show_N_Records}
----------------------------------------
where {?Show_N_Records} is a parameter allowing the user to
specify the number of records to be shown.
3.2 If you need to display a given proportion of Records:
---------------------------------------- RecordNumber > ({?Show_X_Percent}/100) * Count({some_field})
----------------------------------------
where {?Show_X_Percent} is a parameter allowing the user to
specify a number between 0 and 100.
Cheers,
- Ido
CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
www.MilletSoftware.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.