ASP - looping through to one less than Ubound in an array?
#1
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]
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]
#2
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().
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().
#3
Scooby Regular
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
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]
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]
Thread
Thread Starter
Forum
Replies
Last Post
Mister:E
Subaru Parts
2
24 September 2015 01:37 PM