Two Dimensional Arrays

how to get and assign the first dimension of a two dimensional array to another array? For example, I have a recordset object (rsObj) and then I take that object and assign to array (via GetRows() method). I would like to take just the first dimension and assign to another array, but I get a "Subscript Out of Range" error.... any ideas?

temp_array = rsObj.GetRows
new_array = temp_array(0)

View Replies


ADVERTISEMENT

Storing Dimensional Arrays

Does anyone know how to store multi-dimensional arrays in the Application object? And if so please show an example.

Also, how do you loop through multi-dimensional arrays? I just can't seem to get my head wrapped around this.

View Replies View Related

Various Basic Questions Regarding Two-dimensional Arrays

I would like to know how many rows and columns are created in the following array. Is it 10 rows and 2 columns or is it 10 columns and 2 rows? Dim Array(9,1)

I have searched for some info about it but not found any consensus. Some sources claim that the first number symbolizes the rows and the second number the columns and other sources claim the opposite. I am confused.

What is it really like? How many rows and columns?

Assume that I need an array with 2 columns and 5 rows then how should it be declared (4,1) or (1,4)?

Which is the first dimension and which dimension it the second one? Horizontally (first/second) vs vertically (first/second)?

How are the various elements called, for example how is the element on the first row in the 5th column called. By using (0,4) or (4,0)?

Assume that I want to store first and last names in two separate columns in an array and then expand the array by using Redim/preserve. The dimension I want to expand is the one with the rows because I view the array as a table with two columns.

I know there are certain rules that apply when it comes to using Redim/preserve on multidimensional arrays. Only the last dimension can be changed etc. How could that be done in this case? I am mainly interested in the declaration (1,x) or (x,1), where 1 is the number of columns and x number of rows (that is increased).

View Replies View Related

Creating Multi Dimensional Arrays On The Fly

I am trying to setup a 2 dimensional array which i can populate on the fly with data coming frtom a database.

I understand that you have to set a specfic size for the array in ASP, but I am looking at making the array dynamic and using the Redim function to increase the size by 1 each time. Code:

View Replies View Related

Subscripts And Dynamic Multi-dimensional Arrays

I am trying to create a dynamic multi-dimensional array, based on a count from a database. The count is correct, but when I try to Redim preserve my array, I get an error...

Subscript out of range

referring to the line of code...

ReDim Preserve builderArray(CInt(builderCount),5)

How can I do this redim successfully?

View Replies View Related

One Dimensional Array

If I have an Array declared like this:

MyArray = array (“value 1”, “value 2”, value 3”)

Will this array physically be a long single row or a single column (like below)?

Value 1 value 2 value 3

Or

Value 1
Value 2
Value 3

View Replies View Related

Looping Through Tw-dimensional Array

I need to loop through a two-dimesnional array (x,y) until a value in x is empty or the end of the array is reached, whichever comes first. Example array:

Dim myArray(4,1)

myArray(0,0) = "part 1"
myArray(0,1) = quantity
myArray(1,0) = "part 2"
myArray(1,1) = quantity
myArray(2,0) = "part 3"
myArray(2,1) = quantity
myArray(3,0) = ""
myArray(3,1) = quantity
myArray(4,0) = "part 5"
myArray(4,1) = quantity

In the example above, the loop should stop once it determines myArray(3,0) is empty. If myArray(3,0) was not empty, the loop would continue until the end of the array was reached. Anybody have a code example to do this?

View Replies View Related

Two-Dimensional Array Resizing

how do I resize a two-dimensional array? The array I'm working with is "data(X)(Y)" where X is 0 or 1 and Y grows to a dynamic number.If "data(1)(highest element)" IsNull, then I need to strike it from the array. I believe this should be doable by simply resizing the second dimension down by one. Through researching I established the following set of code:

I = UBound(data(0)) - 1
ReDim Preserve data(2,I)

But it results in a "Subscript out of range" message on the latter line. Short of looping through and building a new array.

View Replies View Related

ADODB Versus 2-Dimensional Array

I'm working on developing (yet another) shopping cart for my work. I was wondering if anybody knows which approach leaves a smaller footprint in memory on a server: an ADODB Recordset which stores arrays one-dimensional arrays or a two-dimensional array?

We are currently hosing our web site on a shared machine at Verio. The cart I have to build needs separate carts because a customer's products can come from different locations. Each location will have a different cart. On the cart page itself, I would like to display each cart in a separate location.

Logically, it make the most sense (to me, anyway) to use an ADODB Recordset to manage each individual cart (array) than to write the code to manage the arrays. What are the disadvantages of using ADODB recordset instead of a two-dimensional array in this case?

Which approach would be easier to manage and manipulate? Are there any reasons why I shouldn't use a two-dimensional array? The nice thing about ADODB is that I will not need to program certain features and have access to FILTERS.

Any suggestions about how each approach would scale as site traffic increases? Will one approach bog down the server more than the other? I'm also open to suggestions about a possible, yet illusive, 3rd way.

View Replies View Related

Multi Dimensional Array In Form

what i want to do is have a (multi dimensional?) array, so that each second dimension represnts a row of radiobuttons. The trouble is i don't know what to name the arrays as. Obviously for each row the names for the different radio buttons will be the same, meaning you can only select one.

in php you could do it with a single array as you name each row of radio button differently:

1st row:
name='array[0]'
2nd:
name='array[1]'

in asp it doesn't look like you can do it this way, because to create a similar array you'd do something like
1st row:
name='array'
2nd
name='array'

then use split in the recipient script. This does not work however, because each radiobutton (on all rows) has the same name, and therefore when you click one all the rest on every row are unclicked..

View Replies View Related

Vbscript Mutli Dimensional Array

I understand the logic behind a multi dimensional array (sort of). What I need to do is be able to capture the product information (that is in a product session) that a user has selected and email it to a specific address.

The email coding page is written in javascript. This page is already being used to also send the customer credit information. If anyone has some insight in this I would be very appreciative. Code:

View Replies View Related

How Can I "ReDim" A Two-dimensional Array?

I guess one should declare the array using empty brackets.

Dim MyArray()

Later I set MyArray to:

Redim MyArray(2,3)

The problem comes now. How should I use Redim again? I have heard that only one of the two dimensions can be enlarged or decreased. Is that correct? If so, which dimension would be ok to set to 5 in MyArray. Is ReDim MyArray (2,5) correct or should it be (5,2)?

View Replies View Related

Arrays

I have trouble working with arrays in asp.. I have the following error :Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 0]'

the line that gives me the error is the following:
Door_OpeningValH= aDoor_OpeningVal(0)
and my code is this:

Door_OpeningVal= rs("Door_Open_Dimension")
aDoor_OpeningVal = split(Door_OpeningVal, "x", -1, 1)
Door_OpeningValH = aDoor_OpeningVal(0)
aDoor_OpeningValW = split(aDoor_OpeningVal(1)," ",-1,1)
Door_OpeningValW = aDoor_OpeningValW(0)
Door_OpeningValUnit = aDoor_OpeningValW(1)

what i'm doing is recivieng values from 2 textboxes and a combo box.I want it to save in my database like this:
2x5 ft

View Replies View Related

Arrays

I need to create a multidimensional array using another int as one of the criteria but I keep getting probs with my code, what am I doing wrong?
Code:


intMonthName = Cint(Month(field_in_my_database))
Dim myarray(intMonthName,2,5)
I get this error message:

Quote: Microsoft VBScript compilation error '800a0402'

Expected integer constant

View Replies View Related

2D Arrays

I am using ASP with VBScript and I want to know how to seperate a 2 dimensional array into 1 Dimensional arrays:

like if

MyArray is a 2 D array and I want to store the first row of this array in another array , like in C

MyArray[5][5] //this is a 2D array

OneDimArray=MyArray[0] // stores the first row of the 2D array in OneDimArray

is there a way to do it in VBScript ????

I couldn't find a way

I don't want to do it with loops I hate code with too much loops,

View Replies View Related

Arrays

How can display unique values from an array. I dont want to loop thru all the values and do it. Is there a better way?.

View Replies View Related

Arrays

What does the numeral '1' mean in the following statement?

For J = 0 to UBound(QArray, 1)

View Replies View Related

Arrays

I have an array in ASP and I am populating the array with the values from database on checking a condition. Lets say i have array of arr(5). Initially I made all the array items null ...

View Replies View Related

Arrays

I have an array in ASP called WordsArray() which contains several words. What I would like to do is search the array for a word, and if its not there, add it to another array ResultsArray()

So far, a loop in my code only checks the current array value, and not the rest of the array, adding the search word to the end of the resultsArray regardless.

View Replies View Related

Arrays Of Checkboxes

I have two related tables in my database. One stores events and the other stores a list of key topics.

I have an interface set up where users can add / edit events.

In the add event page, I am querying the "key topics" table and returning them as options (array of checkboxes). The user makes their pick, and submits. All the data saves in the 'event" table, including the primary id of the "topics".

That part works great. The problem I am having is when the EDIT event page resolves, I am trying to "check" the options that were previously saved.

First thing I do (at the top of the page) is to query the events table to pull all of the data out. I use the 'events" table to do this.

For the checkboxes, I am once again looping through them in a query that uses the "key topics" table. So the boxes are displayed, but I can't seem to get the logic right to have the appropriate ones checked. here is my current code:

View Replies View Related

Dynamic Arrays

i want to create a dynamic list or array in asp as we have arraylist in asp.net. what i want is that i want to hold the values selected by the user in a list and in advance i dont know that how much values the user will select. i also tried to use array with redim but that did not work as we can create array with only constant integer parameter.

View Replies View Related

Checkboxes And Arrays

at the moment i am creating a shopping cart of sorts. Simply the user selects the check boxes of the items he wants and clicks submit. The items are dynamically created and they could select anything from 1 to 100 items..

so processing the form is clear not possible by hard coding. How could i read all the values from the POST into an array instead of processing each item at a time.

View Replies View Related

Splitting Arrays

I have a string that looks like this: a|b|c|d%e|f| ...

I split once on "%"

ar1 = Split(Mystring, "%")

then when I try and split the ar1 by

ar2 = Split(ar1, "|")

I get error '800a000d' Type mismatch

I have tried
ar2 = Split(Cstr(ar1), "|")

How can I split this string?

View Replies View Related

Storing Arrays

I have run into a unique issue, what I want to be able to do is store a collection or array into a database or xml file. The main reason for doing this, is I don't want to use Sessions as they are volatile to server hiccups or resets. I don't want to use cookies as they are insecure, but I will use one cookie to store a UniqueID to relate to the data in the database or XML file.Can anyone think of a way to store an array in Access, MySQL, or XML file?

View Replies View Related

Initialise Arrays

I'm trying to create a table summary from SQLServer.
There are ten questions that the user must answer.
I can create the ten arrays, np, but I'm just thinking, say Question 9 never has anyone answer with the value 1, then the following step in the code (the way I see it) would fall on its face.
There are two ways round it that I can see. Test for an empty array 'index', i.e if Array9(1) = "" then ...
But my question is this, is there a way to initialise an array so that all it's values are zero? This would solve the need to test for "" later.

View Replies View Related

GetRows() & Arrays

I have the following:

dim app_ids, irowloop, icolloop
app_ids = get_app_logins(session("stremail"))
for irowloop = 0 to ubound(app_ids, 2)
for icolloop = 0 to ubound(app_ids, 1)
response.write(app_ids(icolloop, irowloop) & ",")
next 'icolloop
response.write("|")
next 'irowloop

That returns:

0,0,bobsmith,pAssWord,|0,71,tom,tom,|0,71,tomf,pAs sWord,|1,5,tom,a1,|
Is it possible to remove the final ',' before the '|' ??

View Replies View Related

Arrays And Loops

What I have is a recordset listing out a group of names. I've retrieved the field that lists the id numbers for the array and split them to a list. Then I want it to loop through the names listing trying to highlight the ids that need to be hightlighted.

What I am getting is my list repeats the names according to how many ids are in the array. So if I have 2 numbers in the array I see every name on the list twice and the two that I need selected.

I want the list to show the names one time with the correct names selected. What is wrong with this code? Code:

View Replies View Related

Recordsets Vs. Arrays?

Is there a performance advantage to parsing thru a recordset verus using an array?

I'm currently trying to populate a listbox by returning data from my database, then either parsing thru the recordset until I reach the EOF, or putting the data into an array.

View Replies View Related

Arrays Vs Dictionaries

Can someone explain to me the performance implications of using Dictionaries rather than arrays? I imagine arrays are lighter but how much lighter?

View Replies View Related

Using Arrays With Names

Is it possible with ASP to use arrays with names (e.g user("username") = "ble") instead of numbers (e.g user(1) = "ble")?(I do know of the dictionary object, but is it wise to use that 7 times or more a page?

View Replies View Related

Contents Of Two Arrays

I'm trying to figure out if there is an easy way to combine the contents of two arrays into one array. Order does not matter, I just want them all together. I'm sort of new to working with arrays, so I don't know if there is a really basic way to do this.

View Replies View Related

Amending Arrays

I have an array of product names what I am storing in a session variable.I am looking at being able to delete a specific item but am having trouble acheiving this. I am retreiving the Session variable and initialising it to a new array, then I want to copy this across to a new array apart from the item that I want deleted. I am having difficulty creating an array using a variable as the new array length.
Code:

Expected integer constant

View Replies View Related

Using Safe Arrays

I have one ASP and sends XML data to another ASP which returns Data from a Database. Pretty straight forward, however the XML string is quite long and I would like to pass it to the second ASP via a POST rather then a GET. Problem is that the only way to retrieve the data is to use the BinaryRead method of the Request object.

This data is only text, but I can not find any reference of how to use the data once I have retrieved it?how do I access the Data from the REQUEST.BINARYREAD?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved