Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Brandon Taylor #1
Randomly Ordered Recordset
Hello everyone,
I'm using MX04, Access, VB Script.
I need to select 10 unique records and randomly order them. I've done quite
a bit of searching online to find an example, but can't seem to find quite
what I'm looking for.
Does anyone have a good example they can point me to?
Many thanks in advance,
Brandon
Brandon Taylor Guest
-
Convert Shared Object properties into ordered array
I need to put the shared object data (that contains the client names) into an ordered array. The following is NOT useful: for (var i in... -
Ordered list in cfoutput?
I'm trying to create an ordered list that will display a list of profiles numerically. I've tried placing the OL both outside the cfoutput... -
Make ordered list
Hello, I have several list items for which I'd like to make an ordered list using Roman Large numbers (I,II,III,)... Each time I press the ordered... -
How to sort 2 arrays and keep indices ordered?
Hi all, Is there an easy way to sort 2 arrays and keep the relating indices together. for instance I have an array of times, and an array of... -
selecting ordered groups out of a table
Rainer Gauweiler wrote: with recent_orders as ( select customer, invoice-nr, date, row_number() over (partition by customer, order by date... -
jv #2
Re: Randomly Ordered Recordset
Whenever you have a challenge like this, break it down into its smallest
components...
As I see it, here's what you need to do.
1) Find out your total number of records
2) Randomly pull the first record item
3) Select a random record again, this time checking to make sure that
you don't already have that record
4) Do this until you get 10 unique records...
If you're in ASP, check out 4guysfromrolla website for code to put the
entire contents of your recordset into an array, that way you make 1
trip to the database, sever that connection THEN do the random thing. I
believe it's called Getrows.
Good luck.
jv Guest
-
Manuel Socarras #3
Re: Randomly Ordered Recordset
as jv pointed out, you can store your recordset in an array with GetRows:
rsArray = rs.GetRows()
then sort the array randomly & choose the first/last/... 10 elements
if your table is too big & you're worried about the array size or
sorting time, you can specify the number of records to retrieve:
rsArray = rs.GetRows(100, 20) ' 100 records beginning from 20
HTH,
manuel
Brandon Taylor wrote:
> Hello everyone,
>
> I'm using MX04, Access, VB Script.
>
> I need to select 10 unique records and randomly order them. I've done quite
> a bit of searching online to find an example, but can't seem to find quite
> what I'm looking for.
>
> Does anyone have a good example they can point me to?
>
> Many thanks in advance,
> Brandon
>
>Manuel Socarras Guest
-
Brandon Taylor #4
Re: Randomly Ordered Recordset
Thanks guys. I check out the 4 Guys method.
Brandon
"Manuel Socarras" <msoc**no-spam**@airtel.net> wrote in message
news:cvj60s$8g9$1@forums.macromedia.com...> as jv pointed out, you can store your recordset in an array with GetRows:
>
> rsArray = rs.GetRows()
>
> then sort the array randomly & choose the first/last/... 10 elements
>
> if your table is too big & you're worried about the array size or sorting
> time, you can specify the number of records to retrieve:
>
> rsArray = rs.GetRows(100, 20) ' 100 records beginning from 20
>
> HTH,
>
> manuel
>
> Brandon Taylor wrote:
>>> Hello everyone,
>>
>> I'm using MX04, Access, VB Script.
>>
>> I need to select 10 unique records and randomly order them. I've done
>> quite a bit of searching online to find an example, but can't seem to
>> find quite what I'm looking for.
>>
>> Does anyone have a good example they can point me to?
>>
>> Many thanks in advance,
>> Brandon
Brandon Taylor Guest



Reply With Quote

