The conditional suppression formula to suppress those records not randomly selected:
WhilePrintingRecords;
NumberVar Array Array1;
not (RecordNumber = Array1)
I suppose you could take this farther and do more testing in case a number was randomly picked twice.
Let me know if you have any questions.
Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
How can one apply this to reports that are grouped? I tried a solution posted to the forums at Crystal Decisions, but it would not always select the number of records I indicated (going above or below my specified count, even when a group had more than the specified number of records).
I think that if you make the rnd() formula the number 1 group of a report with other groupings, and add in the recordnumber <= X to the record selection group formula, this will randomly supply data for the number of rows specified by X.
If you want a random selection for a lower level group, eg. want 5 customers selected at random for each region, use the random function as above as the sort inside the group and the three formaula technique.
Group Header
WhilePrintingRecords; numbervar found:=0
I was not able to get the above described technique to work exactly as I need it to.
I have a report that is grouping first by a selection of companies, then by state. What I need is: for each company, a random selection of records, regardless of state. I think my state group is getting in the way.
I took the following steps:
1. Created a formula with Rnd() in it
2. Sorted by this formula (but did not place it on the report grid)
3. Created the Group Header formula described above and added it to the Company group header
4. Created the Details formula described above and added it to the Details B section (I wanted to confirm the number)
5. Added the conditional suppress logic into Details A
If I remove the State group, it works correctly until the end of a page occurs - then my random number starts over again on the top of the page! So for a company that has 26 records, I get all 26 - 22 on the first page and 4 on the second page.
Do I actually need to add another step or another formula somewhere?
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.