Dynamic Multidimensional Array

is there any way tohave an array where the first subscript is dynamic and the second subscript is static

View Replies


ADVERTISEMENT

MultiDimensional Array In ASP

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

Sorting Multidimensional Array

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

Sorting A Multidimensional Array

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

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 View Related

Dynamic Multidimensional Arrays

I get error when I try to ReDim and Preserve a Dynamic Multidimensional Array. Code:

View Replies View Related

Alpha Multidimensional Array Sort

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

Optimizing Multidimensional Array Code

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

Multidimensional Array :: Microsoft VBScript Runtime (0x800A000D)

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

Sort Filenames With Download Links By Date - Multidimensional Array ??

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

Dynamic Calendar, Need To Create Dynamic Array....

I code that creates a calendar for each month and then it displays events from that month that are stored in a db. I need to loop through my recordset and display all the events, but I can't quite figure out how to do it. I am thinking I need to do an array. But I am not really sure.... any ideas. Here is where you can view the calendar. Code:

View Replies View Related

Dynamic Array

to keep things simple.. lets juz say i hav the following:
Code:
<%
dim i,j
dim region1(0)
region1(0) = 5

i=1
j=0

response.write (region&i&(j))
%>

the above output i got is 10.. so how do i the value of 5 printed instead

View Replies View Related

Dynamic Array

how can we declare a dynamic array in asp.say i have a counter name COUNT.how to i declare an array of size COUNT.its not DIM array(COUNT) cos it will give me a error.how is it done?

View Replies View Related

Dynamic Array

I intend to have a dynamic array of non fixed size

set rsseats = conn.execute("select * from seats")
Dim arr(1)
response.write ubound(arr)
do while not rsseats.eof
ReDim arr(ubound(arr)+1)
rsseats.movenext
loop
set rsseats = nothing

But i will get hit with "The array is fixed or temp locked" how should i fix that

View Replies View Related

Dynamic Array

Does anyone know how to create a dynamic array? I need assign the values from database to the array one by one. I did a search and I can only find some complicated dynamicarray class. I am not to ASP and I have used other programming language. I thought a dynamic array shouldn't be that complicated.

View Replies View Related

Creating Dynamic Array

I wrote a simple code to generate a dynamic array:

Dim TestArray2()
TestArray2=array()
Redim TestArray2(43)

When I uploaded this to IIS (on Vista Basic), the following error
message was given:

"An error occurred on the server when processing the URL. Please
contact the system administrator"

May I know what is the problem?

View Replies View Related

How To Make A Dynamic Array

how do i create a array rs, not sure if the terminology is correct. but i don't want a obj rs i want a array.

View Replies View Related

Data From String To Dynamic Array

Ok, given a string such as this -

203_2_0_0_1_5_0_234_0_8_22_2_0_3_345_2_3_0_0_0_9

Each three digit number in the string represents a unique ID of a file in a database. Following each ID are six digits, all seperated by a "_" . Each file will ALWAYS have six subsequent integers, such as above ID "234" has "_0_8_22_2_0_3_" following it.

What I am trying to figure out is given a string of any length of this specific pattern, how to decarle a multi dimensional array that would hold each ID and its corresponding digits.

To clarify a little further, this is from a shopping cart for a photographer. Each "ID" represents an image, each of the six corresponding numbers for each ID represents a qty for an image print size, ie., 4 4x6's, 5 5x7s, 0 8x10s, 1 16x20, 23 20x30's, 48 wallets. Oh, and the image ID's are not necessarily always going to be 3 digits, they could be of any lenght integer...

View Replies View Related

Multi-Dimentional Dynamic Array

I want to save the details of a SQL search into an Array, Im dabbling and tryin the script below but i get an error Script:

SQL = "select item, number from table"
Set rsTarg = Conn.Execute(SQL)

i = 0

Dim TargArray()
Redim TargArray(i, 1)

do until rsTarg.eof

TargArray(i, 0) = rsTarg("item")
TargArray(i, 1) = rsTarg("number")

i = i + 1

Redim Preserve TargArray(i, 1)

rsTarg.movenext
loop

rsTarg.close

i = i -1

View Replies View Related

Adding Index Number To A Dynamic Array

I've probably done this before, but for the life of me I can't remember how
I did it. I need to move values from a DB table into an array to be used
for other queries. The number of records will vary, so I need to make the
array dynamic. Can someone remind me how I can increment the index when I
write a new record? Code:

View Replies View Related

Limitations Of Multidimensional Arrays

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

Creating And Referencing Multidimensional Arrays

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

Rebuilding Of An Array From An Existing Array

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

Array Integers Vs Array Variables

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

Create A New Array From An Array

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

Dynamic Dynamic Text

Ok, I have a Javascript ASP and in it I have a dynamic repeating table with certain attributes to people. If one of these attributes is old or invalid, i want to change the color of the text (and maybe make it flash, blink, change size, something) so that it's easy to read.

View Replies View Related

Array In Sql

i want to excute given logic

select * from Product_Table where Product_Code in

ARRAY

i.e i want to select Product_Code from VB array and not from a query
is it possible.

View Replies View Related

Array

I know I can do this programatically using a loop but I thought there might be
some easier or more effective way.

I am trying to invert an array.

i.e.

array1 = 1,2,3,4,5

but I want to get

array2 = 5,4,3,2,1

Is there something like array2 = invert(array1)?

View Replies View Related

Array

I have to following code:Code:

dim arrRes(9),getal,som
arrRes=Array(4,4,4,4,4,5,5,5,5,5)
for getal=0 to 9
som=som+arrRes(getal)
next
response.write("Het klasgemiddelde is " &som/10)

I get a type not match error on the second line

View Replies View Related

ASP Array?

I have a page in my admin system where the user can edit products they
have added. The problem I am having is with Related Products. These are
all listed in a multiple list. What I need to do is have those selected
when the product was added, already be highlighted in the multiple list
on the product edit page. Here is my post from another forum.

Code:

View Replies View Related

Array

For some reason, when I try to run the following array, I'm getting an
error:

dim cat(0)

cat(0)="0407"
cat(1)="0102"

'I will be adding more to this array, but just trying with two for
starts.

for counter = 0 to 1

itno=cat(counter)

'I get an error when it runs through this function

Function rightvar(theVar,lengthNeeded)
Dim sResult
sResult=theVar
if Len(theVar)< lengthNeeded then sResult= String(lengthNeeded -
Len(theVar)," ")& theVar
rightvar=sResult
End Function

Can someone help me understand why?

View Replies View Related

Array

The problem is that in my 5 years of programming in various languages i have never really understood arrays (DUMB @$${lol})
What i want to do is offer an advanced search of a database table on my website. I currently offer the functionality so that the whole of the database can be viewed within the web page so that it doesn't need to be downloaded/need access to view it.
What i need to do is run a script that takes all of the column headings that i have and put them into an array. Then with the array i need to output each element into a drop down box.

View Replies View Related

Asp Array

Ok what I have is a little script which runs through my stock compares how many of one item we have compared to what we need and displays the out come.

What id like to do is make an array with the item name so lets say If how many is needed is greater then 0 then add the name of that consumable to an array and move on until the end.

Then I want to use the arry to display each consumable on an order form. Anyone have any idea how to do this in ASP or can give me any advice on a better way to do it?

View Replies View Related







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