ASP Multidimensional Array Values
I am wondering if its possible to load two array ad use one as item title and the other as value, ex:
array1 = "Sally, Jason, Jackson, Marie"
array2 = "24, 54, 21, 33"
For ....
TempSally(Sally) = 24
TempJason(Jason) = 54
....
Next....
View Replies
ADVERTISEMENT
I actually work with multidimensional array (the static or dynamic one)
I've read through to use:
STATIC
=====
dim array01(2,2)
which will make an array of
(0,0) (0,1) (0,2)
(1,0) (1,1) (1,2)
right?
for DYNAMIC
=========
redim array02(2,2)
which will make exactly the same as above, but in dynamic we can extend them, right?
okay... now assume I would like to have value inside array:
array01(0,0) = "some word"
array01(0,1) = some_integer
can I do it? because when I tried to do
====
dim array01(2,2)
array01(0,0) = "test"
array01(0,1) = 5
====
it returns an error:
================
Microsoft VBScript runtime (0x800A000D)
Type mismatch
================
How do I tell ASP that the specific variable is INTEGER, or CHAR or STRING? and How do I manage my problem?
View Replies
View Related
I am trying to sort a multi dimensional array but am getting an error. Can someone please help me out. Here is a sample of the array (it is created dynamically from the db): Code:
View Replies
View Related
is there any way tohave an array where the first subscript is dynamic and the second subscript is static
View Replies
View Related
i have a sorted array of 43 columns. dynamically altered the array and added a new row to the existing array. i need to sort the array based on 2nd column. how to sort a multidimensional array?
View Replies
View Related
I have a multidimensional array with 5 keys. I need to perform a alpha sort on the 3rd key. Does anyone have an example on how to do this?Here is an example of what my array consists of:
mArray(i,0) = '2007-05-02"
mArray(i,1) = "6:00pm"
mArray(i,2) = "TEXT TEXT TEXT" <------------------ NEED TO DO ALPHA
SORT ON THIS KEY ----------------<<
mArray(i,3) = 6
mArray(i,4) = 4
View Replies
View Related
I have a multidimensional array that is actually 1 dimension (it comes from a recordset.getrows that returns 1 column). My goal is to put every single line of the recordset in a textfile. currently, here is my code Code:
for i = 0 to UBound(Res,2)
fileContent = fileContent & res(0,i))
Next
createTxtFile(path,fileContent)
I have 5000 lines and it takes about 10 minutes. I was thinking of doing a Array.Join but I don't think that works with multidimentional array. Also thinking of converting my useless multidimentional array into a sing dimensional array but how?
View Replies
View Related
Hello all,
I am extremely stuck. I am trying to create a simple shopping cart yet keep running into the same type mismatch error everytime, no matter what I do. I have read countless articles about this, even posts in this forum, I've followed their code exactly and still I get the same error.
In the global.asa i am trying to create a multidimensional array with just two columns, product id and quantity, keeping it simple for now.
global.asa
SUB Session_OnStart
CONST CART_COLUMNS = 1
Dim cartArray()
ReDim cartArray( CART_COLUMNS, 1 )
cartMaxUsed = -1
Session("cartArray") = cartArray
Session("cartMaxUsed") = cartMaxUsed
END SUB
Now in my subsequent asp pages I have created functions to add to the array, following code exactly from articles, posts, etc., but everytime I would run them, it would fail on a type mismatch error when I tried to get the UBound of the array.
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'UBound'
/store/add.asp, line 10
So just for testing I simplified it as much as possible and it would still fail on the same line of code. Here is the code for add.asp
Dim cartArray
Dim cartMaxUsed
cartArray = Session("cartArray")
cartMaxUsed = Session("cartMaxUsed")
dim num
num= UBound(cartArray, 2)
response.write num 'for testing purposes
response.end 'only
everytime it fails at the UBound line.
View Replies
View Related
i use this script to generate download links from directories which are first passed to an script to record the number a link is clicked.
the function is calle with a path like:
ListFolderContents(Server.MapPath("/dir1"))
my question now is: can i write this to an multidimensional array (or object oriented?) - and then sort it by date ?? if so how ? Code:
View Replies
View Related
for i = 2 to NOD
newdate = DateAdd("d", 1, newdate)
strdate = strdate & newdate & ", "
next
MyArray = split(strdate, ", ")
I have the above code written in one of my asp pages, the date array is splitted, but how do I get the first and last date assign to a variable.....
int min = MyArray(MyArray.Length-1)
int max = MyArray(0)
I got this code from the web, however it gives me an error:
Code:
Microsoft VBScript runtime error '800a01a8'
Object required: 'MyArray'
View Replies
View Related
i have my database in MS Access. a table name products contains fields:
pro_name
no_of_comp
inserting data from form where products field is mutiline text box. split this and store in array then insert records.
now i want to facilitate let user edit their data.
during editing new products are entered with no_of_comp = 1 and already exisiting products gets no_of_comp= no_of_comp + 1.
if user delete product then no_of_company = no_of_comp - 1.
what i want to do is: Code:
View Replies
View Related
How can I remove a value from an array. Like: remove from array where value=bla-bla?
View Replies
View Related
I have an array which has days of the month stored in it. For example at one
time it might have the values
1,2,3,6,7,8,9
at another time it might have the value
4,5,12,14,19,25
These are days of the month that have been selected and read into an array.
What i would like to do is to write them out and put a "X" where the days
were selected Code:
View Replies
View Related
i m getting these value from a query n stored it in an array:
FY2005 P1 (8/1/2005 - 8/31/2005),
FY2005 P2 (9/1/2005 - 9/31/2005) and so on.
i need to use eg
8/1/2005 as startdate and 8/31/2005 as enddate
similarly
9/1/2005 as startdate and ,9/31/2005 as enddate.
and so on
we can split FY2005 P1 (8/1/2005 - 8/31/2005),
FY2005 P2 (9/1/2005 - 9/31/2005) by using split func in vbscript. But how can we use its subparts.i mean 8/1/2005 etc ...
View Replies
View Related
some ready-made code that will loop through the values in an array and sort them in ascending or descending order? I'm about to start building some new functionality that will need to sort the values in an array and then present them in ascending order. My initial thoughts are to loop through the initial array, find the lowest value and then load that value (and all associated values) into a new array.
View Replies
View Related
I have the following code to check if a field number matches a specific value. here is the code:
View Replies
View Related
I first retrieve the values stored in a session variable (where I have stored an array). Then I assign the session variable to a local array called "myarray".
Assume that "myarray" now contains 5 records. What would the code look like if I want to create a loop that transfers the 5 values from "myarray" into a select box/dropdown list?
How is that done?
View Replies
View Related
I have 24 checkboxes all with the same naming convention, each box has a
value ranging from 1 to 23, what I need to do is fill in the gaps with a
0 value where the user doesn't select a value.
So lets say that the user selects:
1,2,3,4,5,6,7,15,18,19,20
what I want to do is use the split function on the next page to convert
into an array but then I want to redim the array and fill in the missing
values, so I would end up with:
1,2,3,4,5,6,7,0,0,0,0,0,0,0,15,0,0,18,19,20,0,0,0
is it possible to do this and if so how?
View Replies
View Related
I know that cookies can store an array of values, which can be accessed like this:
tempid = Request("cookiename")(i)
Is it possible to use session variables in the same way? Store a array of values in the same session variable and access them on another page by indexing?
I've looked around alot and I've not found anything suggesting that this is possible.
Right now I'm using a single set of cookies to store info on a series of purchaces of the same type of item. I'm hoping to use session variables to replace the cookies.
Does anyone know for certain if this is not possible?
View Replies
View Related
I have part of a keyword search function that is acting supernatural - I have a bubble-sort function that sorts the content of an array, then returns an array containing the item numbers of the original array, arranged in order according to their content. Code:
View Replies
View Related
how to create an array of checkboxes that were selected from a form on one page and pass them into hidden fields in a form on the next page? I have this massive project I've been working on and am having trouble with this.
View Replies
View Related
I am trying to filter a table of users to select only those records
whose roleID matches a value in an array. There could be any number of
IDs held in the array from one to a few hundred. The array is
generated by splitting a comma delimited memo field from a second
table in an Access DB. I can split the memo field OK, I can
response.write its values, but what I now want to do is add a value
from another table to my reponse write loop. Code:
View Replies
View Related
I have this dynamic array(shown below) that I need to match to values (1 - 10) that I am returning from the database via DSN connection object.
The values I need to match are on the same page (in their own table) but I am not sure how to match up the array indexes to these values. I want to be able to display the array result as part of or nested in another table. Code:
View Replies
View Related
if i have a vbscript function on a certain form and I assigned some values on an array variable on that function, is there a way for me to retrieve the values of that array on another asp page once i submitted the form?
View Replies
View Related
I am coding an ASP script, which currently requires a 5-dimension array, i.e. array(a,b,c,d,e)
I remember reading somewhere, a long time ago, that there is a limit to the number of dimensions in ASP. That was a long time ago, and I don't remember.
View Replies
View Related
I get error when I try to ReDim and Preserve a Dynamic Multidimensional Array. Code:
View Replies
View Related
I'm just confused because I'm obviously calling the code wrong but every tutorial I find makes it seem like I'm referencing the multidimensional arrays correctly so I don't knwo what I'm doing wrong. Code:
View Replies
View Related
I dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
View Replies
View Related
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
View Replies
View Related
I want to call a recordset so you can edit the details and then obviously pass the parameters onwards into the db. However, the user guide just says this:
To process other fields in the form, use the Form collection of the upload object the same way you would use the Form collection of the Request object. For example, if your form had a text element named UserName, your processing code would include: Code:
View Replies
View Related
i need to convert the escape values which are by mistake updated in DB.
example:
this is a sample text string
is updated in DB as
this%20is%20a%20sample%20text%20string
here %20 is the space.
like wise there are many entries for :,'
is there way that i can update all this in a update statement?
or use asp to to update the records?
View Replies
View Related
I have a variable SET which has the value Of 1, 2, 3, .., N.
SET=val1, val2, val3, val4, ..., valN
What is the commend or procedure to extract individual values, val1, val2, ...
View Replies
View Related
I want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.
I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?
View Replies
View Related