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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Selection

Status
Not open for further replies.

djieon

Technical User
Aug 19, 2008
107
0
0
GB
Hi All, I know there some other topics on here about random selections but mine is a little more complicated so hope for some advice!

I have to produce a report that has 120 records appear in it, by selection. So on each details line I curently have the rnd() function and then sort on that number and select the top 120. However each record can belong to one of 9 areas (New York, Berlin, Las Vegas, London, etc...) and each time I run the report I have to pick three of these areas, so what I want to be able to do is for my report to divide the 120 records by the number of areas (3) and then give me 40 random records for each of the areas.

Is this possible?

Thanks.

David.
 
Add a multi-value parameter in your record selection formula that allows you to pick three areas.

In the report, insert a group on {table.area}. Then add rnd() to the detail section and use it for the sort.

Then insert a running total {#cntwingrp} that counts a non-null, recurring field, evaluates for each record, and resets on change of group (area). Then go into the section expert->details->suppress->x+2 and enter:

{#cntwingrp} > 40

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top