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


ADVERTISEMENT

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

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

Dynamic Multidimensional Array

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

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

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

Array Sorting

I need a array with x numbers (1 to x) mixed. Like this:

Using 4 numbers (1 to 4), i need:

array(1) = 3
array(2) = 2
array(3) = 4
array(4) = 1

This is random. I make this: Code:

View Replies View Related

Re-sorting An Array

point me to a good online tutorial (preferably for slow learners) about advanced handling of arrays, like re-sorting the data, etc.?

View Replies View Related

Sorting Values In An Array

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

Sorting Integers In An Array

I have an array, PositionArray(), which contains a variable number of integers. I need to sort these array elements numerically. Seems I've done this before in VB, but I can't seem to get my mind around it now. Does anyone have a simple bubble-sort code, or is there an ASP way to do this?

My ultimate goal is to take a chunk of text, and highlight (bold, color, whatever) words that are contained in a string array. My thought is to find the position of each word with the InStr() function, then find out which position occurs 1st, which position occurs 2nd, etc., then build a string from the beginning of the text chunk to the position where the first word begins, add a bold tag, add the word, add a </B> tag, and continue until the end of the chunk.

View Replies View Related

Sorting And Displaying An Array

I have some information that I want to put into an array and display the next 3 events based on the date.

I don't want to display any events that have already have already expired. Also, I ONLY want to display the next 3 events...nothing more. So how do I go about this? I am a HORRIBLE ASP programmer, so consider me a newbie. There are 4 pieces of info that I want to display with this..."Show", "Location", "Booth", and "Dates".

View Replies View Related

Bubble Sorting A Multi-dimention Array

What I need to do is sort an dimention array by the name field and the best way I can think of to do this is by a bubble sort. However, I'm running into a problem with the bubble sort and I'm sure I'm just missing something simple.Here is the code I have Code:

Dim objAllBrands, objBubbleArray, a, i

For i = 1 to objAllBrands.count
For a = 1 to objAllBrands.count
If objAllBrands.item(a).Name < objAllBrands.item(i).Name then
objBubbleArray = objAllBrands.item(i)
objAllBrands.item(i) = objAllBrands.item(a)
objAllBrands.item(a) = objBubbleArray
End if
Next
Next

It doesn't like this line objBubbleArray = objAllBrands.item(i) and I'm sure there are other problems. Can anyone give me a hand with this?

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

Dynamic Multidimensional Arrays

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

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

Sorting XML

I've had an ASP project dumped on me written in VBScript. I'm actually a
C#/ASP.NET developer and am struggling trying to find a way to sort the
result of a XPath query executed using SelectNodes?

I'd rather not rely on external XSL files if possible.

View Replies View Related

Sorting

I have this database that contains four columns (ID, Name, Qty1, Qty2). I can display the data on an ASP just fine but what I want is to display the data in Ascending order of the total number between Qty1 and Qty2 of each record (Qty1 + Qty2 = QtyTotal). Obviously the total number is not stored somewhere in the database. So how can I accomplish this?

View Replies View Related

Sorting And Paging

I try to find a script in ASP that combines sorting and paging. I already found various scripts that do one or the other but none does it both. I know I should combine them, but it is very difficult at my level of asp knowledge.

View Replies View Related

ASP Sorting Problem

I wanna ask how to do the following sorting function, for example

Name Age
Brian 22
Alice 17
Patrick 21

when click on name, it will sort by
Alice
Brain
Patrick

when click on age, it will sort by
17
21
22

Is it execute the SQL by hyperlink..? Can anyone give me an example?

View Replies View Related

Sorting On Fields ?

I created a script which suppose to sort on 2 fields. Everything works fine with no errors except when I click on the field that suppose to sort the data it does nothing.

This is the code: Created on test table name Reports2 3 fields id, r_date, r_doc_title

Code:

View Replies View Related

Column Sorting

Can someone please explain to me why the hyperlinked column headings will sort in Firefox and IE 7 but not in IE6. Code:

View Replies View Related

Sorting Problem

I have a set of records which are sorted AtoZ in display. Problem comes is like:

A.1
A.10
A.2
A.20
A.3
A.4
A.5
A.6
A.7
A.8
A.9

Actually A.10 is required after A.9 and A.20 after A.19.

I have searched for this, but found that on every page it sorts records like this. Also, I can not sort items based on ID (auto increment) because certain items are added at later time and some first.

View Replies View Related

Database Sorting

I'm programming as ASP site to show the results of dynamically querying a MS Access database and outputting the results in a table. I've got that part to work. But, what I can't get to work is for the header row of the table to be links to sort the data ascending or descending by that particular field. All I can get to work is having a little +/- next to the column header and those sort it, but I can't figure out how to get the headers themselves to do both sorts when clicked.....can anyone out there help??? Thank you in advance!!! Also, if anyone knows about Access 2000, I've never tried doing this in it before, but I need to export one of the field to be links to HTML pages that describe those seminars, has anyone done that? Just figured I'd ask while I'm typing this

View Replies View Related

FileSystemObject - Sorting

Is there any way to sort the files and folders according to different things (i.e. size, date, etc.)? I'm using For...Next loops.

View Replies View Related

Sorting Recordsets

I have never sorted a recordset - using rs.Sort - i have no problem sorting it in SQL.
All the tutorials i get say that i have to use a client cursor location, so this is my code:

View Replies View Related

Recordset Is Not Sorting

I have the following code which connects to an access database table and prints out each record. For some reason, the ASC is not sorting the records for me. Can anyone see the problem? Code:

View Replies View Related

Sorting By Recordsets Value

I have a table that is just dumping an entire database data. I would like to have the values of the columns re-sort the data. Not the column heads for the data displayed under the column head varies.

For example, one column, Components, displays 80 components types and another column, Category, displays 40 categories types. When a visitor clicks on one of the component values, it should then display only that data. I've done this before but, it has been a very long time. I remember creating a link surrounding the recordset in my table but what was written.

View Replies View Related

Record Sorting

I'm trying to display number of records query and the results I'm getting are only for 10 and not the total number of records queried. For example if I query field "CA" and I know California has 12 records it still only gives me 10 records. Attached is the script.

View Replies View Related

Paging And Sorting

can you tell me how to sorted table, and how to make the paging?

View Replies View Related

Sorting Alphabetically

I am trying to create a query to list products alphabetically. I want to have the letters of the alphabet on the web page and when someone clicks on the letter A for example, I want to list all the products beginning with the letter A. For B, all the products beginning with the letter B, and so on.

In my query, I know I need something like WHERE (((Product) Like "A*")), but how do I structure the query so I'm not listing Like "A*" for each of the 26 letters of the alphabet.

View Replies View Related







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