Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

ASP - looping through to one less than Ubound in an array?

Thread Tools
 
Search this Thread
 
Old 30 July 2002, 10:22 PM
  #1  
AdrianFRST
Scooby Regular
Thread Starter
 
AdrianFRST's Avatar
 
Join Date: Oct 2000
Posts: 368
Likes: 0
Received 0 Likes on 0 Posts
Post

Prepare to be thoroughly confused.

I'm using ASP VBscript nested arrays to build the select boxes on this page:

http://www.diveride.com/suitfactory.asp?step=1

The arrays that build the first select are:

arrChoicesCatName = Array("Material","Colour","Boots","In Vent","Out Vent","Zip")

arrMatOpt = Array("Nylon","Rubber","Rubber Cord",arrMatPos)

arrMatPos = Array("left side","right side")

The code to loop throught the material choices is:

For i2 = Lbound(arrChoicesCatOption(i)) to Ubound(arrChoicesCatOption(i))

But what I need to do is loop through until one before the Ubound as the last value of the array contains the next array down the tree, in this case another select for 'position'.

I've tried:

For i2 = Lbound(arrChoicesCatOption(i)) to (Ubound(arrChoicesCatOption(i) - 1))

Doesn't like it.

Clear as mud eh?

Thanks!

[Edited by AdrianFRST - 7/30/2002 10:25:21 PM]
Old 30 July 2002, 10:31 PM
  #2  
nigelward
Scooby Regular
 
nigelward's Avatar
 
Join Date: Oct 2001
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Post

How about:

For i2 = Lbound(arrChoicesCatOption(i)) to (Ubound(arrChoicesCatOption(i)) - 1)

You want to take one away from the value returned by UBound() rather than attempting to substract 1 from the array that was passed into UBound().

Old 30 July 2002, 11:51 PM
  #3  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

tried subtracting the 1 in to an integer on the line prior?

also wouldnt you need to do (i-1)

Ie... havent got a IIS box near me to play so...

for i2 = Lbound(arrChoicesCatOption(i)) to Ubound(arrChoicesCatOption(i-1))

??? or do

iTemp = i -1
For i2 = Lbound(arrChoicesCatOption(i)) to (Ubound(arrChoicesCatOption(iTemp)))

Unsure about third brackets..

just realised what nigel is saying now... doh... forget what I said.

David

[Edited by David_Wallis - 7/31/2002 8:31:11 AM]
Old 31 July 2002, 10:33 AM
  #4  
AdrianFRST
Scooby Regular
Thread Starter
 
AdrianFRST's Avatar
 
Join Date: Oct 2000
Posts: 368
Likes: 0
Received 0 Likes on 0 Posts
Post

Thanks Nigel. Worked a treat!
Old 31 July 2002, 08:41 PM
  #5  
nigelward
Scooby Regular
 
nigelward's Avatar
 
Join Date: Oct 2001
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Smile

Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Darrell@Scoobyworx
Trader Announcements
26
30 January 2024 01:27 PM
Mister:E
Subaru Parts
2
24 September 2015 01:37 PM
john banks
ICE
8
21 June 2001 11:17 PM
RT
Drivetrain
3
30 May 2001 01:03 AM
dowser
Drivetrain
21
24 May 2001 12:01 AM



Quick Reply: ASP - looping through to one less than Ubound in an array?



All times are GMT +1. The time now is 02:22 AM.