INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Report Development

Displaying a Random Sample (number or proportion) by IdoMillet
Posted: 3 Mar 03

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

Back to Business Objects: Crystal Reports 4 Other topics FAQ Index
Back to Business Objects: Crystal Reports 4 Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close