Typhoon101
08-03-2006, 08:02 AM
I use ASP VERY little, so am having a problem with Arrays.
I have an array containing many items. Each item itself is another array. this is the code i have. In reality, there are many more items than the five i show here.
Dim myArray(4)
myArray(0)=Array("item","item","item","item")
myArray(1)=Array("item","item","item","item")
myArray(2)=Array("item","item","item","item")
myArray(3)=Array("item","item","item","item")
myArray(4)=Array("item","item","item","item")
This works fine, and my code extracts the bits i need as expected. the problem i have is purely maintenance. every week i have to remove certain elements from the array. The next week i need to put the elements back in and remove others and so on.
Although this is easily acheived by commenting out the array element i want to remove, it means i have to re-number all remaining items, count them and change the myArray length. With over a hundred different array items, this is very time consuming. Ideally i would like to be able to just comment out the required items.
In JavaScript i would be able to do this by doing something like:
n=0;
myArray = new Array();
myArray(n) = new Array("item","item","item","item"); n++;
myArray(n) = new Array("item","item","item","item"); n++;
//myArray(n) = new Array("item","item","item","item"); n++;
myArray(n) = new Array("item","item","item","item"); n++;
myArray(n) = new Array("item","item","item","item"); n++;
This doesn't appear to work in ASP, and doesn't take into consideration the declared array length.
Can someone please let me know if there is an easier way to acheive my goal.
Thanks
I have an array containing many items. Each item itself is another array. this is the code i have. In reality, there are many more items than the five i show here.
Dim myArray(4)
myArray(0)=Array("item","item","item","item")
myArray(1)=Array("item","item","item","item")
myArray(2)=Array("item","item","item","item")
myArray(3)=Array("item","item","item","item")
myArray(4)=Array("item","item","item","item")
This works fine, and my code extracts the bits i need as expected. the problem i have is purely maintenance. every week i have to remove certain elements from the array. The next week i need to put the elements back in and remove others and so on.
Although this is easily acheived by commenting out the array element i want to remove, it means i have to re-number all remaining items, count them and change the myArray length. With over a hundred different array items, this is very time consuming. Ideally i would like to be able to just comment out the required items.
In JavaScript i would be able to do this by doing something like:
n=0;
myArray = new Array();
myArray(n) = new Array("item","item","item","item"); n++;
myArray(n) = new Array("item","item","item","item"); n++;
//myArray(n) = new Array("item","item","item","item"); n++;
myArray(n) = new Array("item","item","item","item"); n++;
myArray(n) = new Array("item","item","item","item"); n++;
This doesn't appear to work in ASP, and doesn't take into consideration the declared array length.
Can someone please let me know if there is an easier way to acheive my goal.
Thanks