Bubble-sort Routine Changing Array Values

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


ADVERTISEMENT

String Bubble Sort

Can u tell me a bubble sort for strings using ASP? I have a text
file of words id like to sort and count.

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

Sort Array

Which would be faster?

1) Bubble sort
2) Join Array remove empty delimaters and then Split.

I am thinking the second would be a faster routine wouldn't it?

View Replies View Related

Array Sort Of Question

I have a group of variable i wish to get out of the url

like www.domain.com?id1=30&id2=50&id4=99

now i can get the values no problem using request.querystring.

my problem is i need to use the more than once, and I want to put them through a loop, to make different lines of code, if i use an array it only picks up the info once then i am pooped.

I have tried id&(i) and using a next loop looop, but that only picks up th i as the number not the variable.

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

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

Getting Values From Array

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

Entering Values From Array

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

Remove Values In Array

How can I remove a value from an array. Like: remove from array where value=bla-bla?

View Replies View Related

Writing Out Array Values

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

Spliting An Array And Using Its Values

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

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

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

Comparing Count To Array Values

I have the following code to check if a field number matches a specific value. here is the code:

View Replies View Related

How Can I Transfer Values From An Array To A Select Box?

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

Rediming An Array With Non Selected Values

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

Session Variables Store Array Of Values?

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

Changing Values In 1 Listbox When Selecting Records In Another Listbox

I was wondering if you could help me with the following problem. I have 2 listboxes in my
webpage, 1 has cities, and the other lists the streets of the city from the first listbox.

When I click on a city, I want the 2nd listbox to populate with all streets in the city. The city and streets are saved in a database, so when the user selects the city, I will run a query on the database and populate the 2nd listbox with all streets.

How can I do this with normal ASP? I know how to do this with ASP.NET, but don't know how to activate this with normal ASP?

View Replies View Related

Asp: Pass Array Element Values To Form On Next Page

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

Problem Filtering Recordset By Values Held In Array

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

Matching Array Index To Values Retrieved From Database

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

How Do I Retrieve Values Of An Array Variable From A Form To An Asp Page?

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

ASP Routine

I need a routine to check for a number called CPF (just like Social
Security Number in USA). I already have a validation routine for that
number, but I still need to check if it exists on the institution
databank to avoid frauds on my system.

The idea is to build a "new user register page" and with a CPF field.
So, when the person enter his CPF, the ASP page would check on the
institution databank and validate or not the number. The url for the
public query is the following, remember to replace "hxxp" with "http"
to open the page correctly: Code:

View Replies View Related

CDO + CDONTS Email Routine?

Just curious... Some webapps that I develop could be deployed on older NT
systems OR Win2K3...

Is there a simple test for CDO/CDONTs that I can use in code so I could
implement both routines and use the one that's existing on the server?

View Replies View Related

Activating Sub Routine From Hyperlink

I am still playing with ASP and was wondering how to do this (it seemed
simple). What I want is to have a hyperlink that when it's clicked on, will
run a sub routine, instead of opening a web page... Right now I have;

Sub CreateLinks()
Response.Write "<br><br>"
Response.Write "<a href='OpenAllOrders()'>1. All Orders</a><br>"
Response.Write "<a href='OpenCustOrders()'>2. Customer Orders</a><br>"
Response.Write "<a href='OpenInvoices.asp'>3. Open Invoices</a><br>"
End Sub

Sub OpenAllOrders()
Response.Redirect "OpenOrders.asp?Customer=0"
End Sub

Sub OpenCustOrders()
Response.Redirect "OpenOrders.asp?Customer=1"
End Sub

The issue, is that clicking on the link, tries to open a web page file of
'openallorders()', instead of running the sub routine. Obviously I am
missing something simple... Can anyone point me in the correct direction
(think it has something to do with href... maybe it should be hsub or
something).

View Replies View Related

Error Handling Routine

I have an error handling routine that emails me the Err.Source, Err.Nbr, and Err.Description in the event of an error. How can I include the line number of the error as well and the filename?

View Replies View Related

Conditional Routine And Date

I'm trying to not show some data dependant on date but it never works right.

<% If Request.QueryString("EventDate") > DateAdd("d",6,Date()) Then %>

I have used similar routines before and it worked fine but this time i'm using a QueryString instead of a database field.

View Replies View Related

Syntax Error When Calling Sub-routine

For some strange reason, on a certain page of my site I cannot create sub-routines.

Everytime I get the same error, no matter where this subroutine is,
what it does, and what its name is.

Microsoft VBScript compilation (0x800A03EA)
Syntax error ..... etc...path...to...doc.asp, line 34
sub SubRoutineName()

What could be happening here?

View Replies View Related

Select Sort

I have a script that I want to display the returned list numerically in. The database is deciding how to order the list, and is being displayed pretty loosely. Is there anyway I can sort the returned list numerically here? Code:

View Replies View Related

Sort By Part

I have a database table, that I need to sort by PART of the contents of a field (named rFieldName in the table):sample contents of this field are:Code:

qid_5_question_1
qid_12_question_5_0_1
qid_12_question_5_0_2
qid_12_question_5_1_1
qid_12_question_5_1_2
qid_12_question_5_2_1
qid_12_question_5_2_2
qid_12_question_5_3_1
qid_12_question_5_3_2
qid_6_question_2I need to sort his field by the value that appears AFTER the 3rd underscore, and if applicable BEFORE the 4th underscore
Is this possible - can you help please - I have no idea where to start on this as I've never had to try to do something like this before.

View Replies View Related

JS Sort Function

I have a JS/ASP application that sorts a SQL populated table.
This works great, and sorts the data fine, apart from my currency columns.
It wants to read the data as text as far as i can gather. Ths data in ASP
looks like this -
<% =formatcurrency(RS("income"),2)%>
I have tried changing this to a number (formatnumber) and hard coding a £
sign, yet it still wants to read the data as text, rather than numerical?
How can i get my JS function to read currency or if not, eliminate the
forehand figures. I need the data to appear as a currency, yet be sorted as
a number (rather than taking the 2st digit)if this is a
common problem (sorting currency) and there was a universal solution around
this

View Replies View Related

Sort Text

I've lurked on here for awhile but I've come upon something I'm having trouble with.
I have a database table of movie titles and I want to sort by the column, but ignore the articles in the title, "a", "an" or "the"... "The Lion King" would be under L... "A Bronx Tale" would be listed under "B", etc.
Does anyone have a function that does this or know of another method? Or am I forced to enter them as "Lion King, The", for example?

View Replies View Related







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