|
-
May 15th, 2002, 12:10 PM
#1
Thread Starter
Junior Member
Separate like values in an array
I am pulling an ADO recordset in VB code. the fields in this recordset are "OrderID", and "Industry"
I am reading these items into an array for processing . Orders next to each other in the array cannot have the same industry if at all possible. I need a way to split them up and guarantee that if I have a situation like 7 orders with three of those belonging to the same industry that they don't end up next to each other.
Any ideas would be helpful
-
May 15th, 2002, 12:14 PM
#2
Frenzied Member
can you explain why you need that?
-
May 15th, 2002, 01:23 PM
#3
This may work.
Initially read the data into separate arrays, one for each Industry.
When that is done, loop through the separate arrays and load them into the final array staring with the (0) entry of the individual arrays, followed by the (1) entry of each array, etc.
-
May 15th, 2002, 01:35 PM
#4
Thread Starter
Junior Member
I need this because I'm creating a play schedule for a video advertising board that rotates a set of advertisments (i.e. 65). As I'm listing these I don't want to have two competing beer ads next to each other in the rotation. Although they can be set one apart (like beer, car dealer, beer, Pest Control, beer)
The ideas above is decent, save for the fact the the number of arrays could grow pretty large (like > 50) and I don't think I want to declare that many arrays.
-
May 15th, 2002, 01:46 PM
#5
What do you see as the problem with 50+ arrays? I assume that you will not have a lot of records in each, so space can't be the problem.
-
May 15th, 2002, 02:21 PM
#6
Frenzied Member
What about putting values in random indexes in the same array???
YOu first sort the recordset so that the values which are alike comes together then read the recordset and use randomize and rnd functions to put the values in the array..Well you'll have to check for the bounds and repetition of same index.. but it'd save managing multiple arrays..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|