| | |
Sort multidimensional array on more than one column?
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I'm working in VBScript and want to sort a multidimensional array on two of the columns in it. I've got a function (based on TONS of examples around the Net) that is sorting on one column, but I can't seem to get how to then do a second column. I'm not seeing a lot when searching, either. Is there a known algorithm or something for doing a sort on multiple columns? Someone must have done this before!!
Alternatively, how might I go about taking a request.forms collection, putting that into a two dimensional array (forms name, forms name value) and then in turn splitting the name and putting that into an array? Ehh, that's a bit confusing....here's what I'm trying to do:
I'm building a form dynamically, and building the input names from dynamic data. My forms collection then looks like this - I have a number of name,value pairs like this:
IDNum_CODE_fieldname, value
Ultimately, I want to do something like "update tablename set fieldname=value where idkey=IDNum and codetype=CODE" So I want to parse/split the forms name shown above. Since I'll have common IDNum and CODEs, I want to group them by sorting.
Hope this is a little clearer, and thanks for any info!
Alternatively, how might I go about taking a request.forms collection, putting that into a two dimensional array (forms name, forms name value) and then in turn splitting the name and putting that into an array? Ehh, that's a bit confusing....here's what I'm trying to do:
I'm building a form dynamically, and building the input names from dynamic data. My forms collection then looks like this - I have a number of name,value pairs like this:
IDNum_CODE_fieldname, value
Ultimately, I want to do something like "update tablename set fieldname=value where idkey=IDNum and codetype=CODE" So I want to parse/split the forms name shown above. Since I'll have common IDNum and CODEs, I want to group them by sorting.
Hope this is a little clearer, and thanks for any info!
Thanks for the help! I think I tried that, and all it did was first sort by the second column, and then sort by the first column, independent of what had already been sorted. I think it was the function I was using. Anyway, I gave up on that, and did something else. I ended up just sending over my "value" as IDNum_CODE_fieldname_value, and then sorting that. Sorting a single dimension array is easy, and then I just parsed it out once it was sorted that way. Sometimes the quick and dirty way is right under my nose
Thanks again!
Thanks again! ![]() |
Similar Threads
- Sort A Multidimension Array (Python)
- Multidimensional array sort problem (C++)
- How to Sort a MultiDimensional Array (C)
Other Threads in the ASP Forum
- Previous Thread: Strange behavior with Date() function
- Next Thread: Where can I get a Library of std ASP functions
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection diagnostics dreamweaver excel fso iis microsoft msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption server single specfic sqlserver sqlserverconnection toolkit webserver windows7





