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

Random selection of records

Status
Not open for further replies.

Viscount

IS-IT--Management
Oct 10, 2003
85
GB
I have had a look through and found that I can select a random number of records: using rnd()and sorting by it and then adding recordnumber > # of records required.

my problem is that I have an age field within the record and I would like to have 28 random records for each age (8-16 inclusive)

I have tried to add a few when and if statements but I cannot seem to get them right.

Incidently the age field is generated by a formula (taken from here) and entered into the details section.

Any ideas..?

Thanks
 
A simple solution would get accomplish this but your Age groups would be kept together.

Group on @Age formula.

Under Report,Edit Selection Formula, Group add this:
Code:
Count({table.field},{@Age}) <= 28 AND
{@Age} in [8 to 16]


~Brian
 
Thanks for that...

I did try this - but it did not come out the way that I wanted it to - infact I am not so sure that it worked at all - I could nto see any changes.

Any other suggestions..?
 
First use rnd() and sort by it.

Then create a running total {#cntwingrp} using the running total editor. Select a recurring field, count, evaluate for each record, reset on change of group (Age). Then go to format section->details->suppress->x+2 and enter:

{#cntwingrp} > 28

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top