BusinessObjects Board

Random Sampling Using a String Field

Hello,

I have a report that simply pulls a list of IDs. The ID’s are strings however only numbers are used as the IDs. For example:

0013131342420
0012340240242

The report pulls back all ID’s. I would like to modify the report to bring back 20 randomly selected ID’s.

This sounds so simple to do but I am out of ideas and banging my head against the wall :hb: . Please Help!!

Thanks!
pete


pete171 (BOB member since 2008-09-22)

Hmmm

You could only do this in Crystal with suppression, if you wanted it pushed to the database you`d have to do it in a stored proc or a view.

In Crystal create 2 formulae (rnd1 and rnd2) that say Ceiling(Rnd()*10).

Then create a record selection that is

@rnd1 = @rnd2

This will pick off a random set of details every time the report is run.

If you only want 20 or less, just suppress the details section where recordnumber <= 20.


ABILtd :uk: (BOB member since 2006-02-08)

If I wanted 5% randomly selected, would I need to use 5 instead of 10 in the formula?

Why do you have @rnd1=@rnd2?


michcl (BOB member since 2019-09-24)

When you say create record selection @rnd1=@rnd2, do you mean to put that in section formula (filter), or select expert somewhere?


michcl (BOB member since 2019-09-24)