Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Random Sample Bassed on percentage Post Reply Post New Topic
Author Message
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Topic: Random Sample Bassed on percentage
     Posted: 21 May 2014 at 4:19am
Every month I have to generate a random set of data based on percentages. 
 
I have seen posts from a general search on how to do it by a specific number, but not on perctanges. 
 
I have all of the other record selection formulas in the report all I need now is to figure out how to only retrieve 10% (as an example) of the records returned. 
 
 
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 21 May 2014 at 7:02am
try create a formula1 like

WhilePrintingRecords;
numbervar x;
x:= x+1;
x

then create another formula2 like
count(sume_field)*.1

in section expert click x-2 next to suppress
formula1 > formula2

IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 22 May 2014 at 1:53am
Thank you so much. 
 
Much eaier solution than some of the others I was finding. 
 
Just so that I undertand it correctly the
 
"(count(some_field)*.1) is hte driver for the percentage?
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 22 May 2014 at 6:30am
yes.as in you example it is the 10% of records.


Edited by kostya1122 - 22 May 2014 at 6:31am
IP IP Logged
bremen
Groupie
Groupie
Avatar

Joined: 28 May 2013
Online Status: Offline
Posts: 93
Quote bremen Replybullet Posted: 27 May 2014 at 12:14am
Thank you.  Just wanted to be sure before making changes. 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum