Sign in to follow this  
Followers 0
MrMikl

arraysort blanks out multi dim arrays

2 posts in this topic

Hi

I am trying to compare prices, along with other data, and simply list them in lowest price to highest price. I did see the listview control mentioned by someone else. In fact, in another forum, they gave the correct syntax that does not appear to be in the help screen.

At any rate, unless the Ubound is a even number and not an odd number, _ArraySort appears to work. No matter how I changed the parameters, _ArraySort blanks out the array.

#include <array.au3>

Dim $price[$max][$max]

Dim $Products[$max]

;load prices from database using a text file

; the prices do load cause I used a While loop to display the prices after the load and after sort

; Another PS DisplayArray function is no longer available in 1.7.1

$num = Int($num)

_ArraySort($price, 0, 0, 0, UBound($price, 1), 2)

; these parameters are the only ones that do not throw an error. I tried UBound($price, 2), etc

; it gives me a division error, the array must be an even number. To get the correct number, of 155,

; throws a division error.

; price{1][$loopnumber] = the record number. so I can arraign $price with the correct array entry

; for $Products

; When I try to find the record number, the array price[1][$loopnumber], $price[0][$loopnumber] is blank

; I will try the list view option next.

Exit

Is there ANY error checking in this compiler? There is no list of error codes. There seems to be no Try Catch or ON ERROR.

Am I using the BETA version?

Thanks for any answers you may provide

MrMikl

mrmikl@yahoo.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

does that help?

#include <array.au3>

Global $avArray[5][2]
$avArray[0][0] = "c_JPM"
$avArray[1][0] = "a_Holger"
$avArray[2][0] = "b_Jon"
$avArray[3][0] = "e_Larry"
$avArray[4][0] = "d_Jeremy"
$avArray[0][1] = 1
$avArray[1][1] = 3
$avArray[2][1] = 2
$avArray[3][1] = 5
$avArray[4][1] = 4

For $i = 0 To UBound($avArray) - 1
    ConsoleWrite($avArray[$i][0] & " | " & $avArray[$i][1] & @LF)
Next

ConsoleWrite("- - -" & @LF)

For $i = 0 To UBound($avArray) - 1
    If $i = 0 Then ConsoleWrite("Des 0" & @LF)
    _ArraySort($avArray, 1, 0, 0, 2, 0)
    ConsoleWrite($avArray[$i][0] & " | " & $avArray[$i][1] & @LF)
Next

ConsoleWrite("- - -" & @LF)

For $i = 0 To UBound($avArray) - 1
    If $i = 0 Then ConsoleWrite("Asc 0" & @LF)
    _ArraySort($avArray, 0, 0, 0, 2, 0)
    ConsoleWrite($avArray[$i][0] & " | " & $avArray[$i][1] & @LF)
Next

ConsoleWrite("- - -" & @LF)

For $i = 0 To UBound($avArray) - 1
    If $i = 0 Then ConsoleWrite("Des 1" & @LF)
    _ArraySort($avArray, 1, 0, 0, 2, 1)
    ConsoleWrite($avArray[$i][0] & " | " & $avArray[$i][1] & @LF)
Next

ConsoleWrite("- - -" & @LF)

For $i = 0 To UBound($avArray) - 1
    If $i = 0 Then ConsoleWrite("Asc 1" & @LF)
    _ArraySort($avArray, 0, 0, 0, 2, 1)
    ConsoleWrite($avArray[$i][0] & " | " & $avArray[$i][1] & @LF)
Next
ExitoÝ÷ Úí+ºÚ"µÍÈ^HÛÜÚ[ÛYIÐ^K]LÉÝÂÛØ[    ÌÍÜÛÛÖÍHHÉ][ÝÑZ[wØÚ[YY[][ÝË   ][ÝÔÚØ]ÚI][ÝË    ][ÝÔÝ[YI][ÝË   ][ÝÒ[ÈYØZ[][Ý×BÛØ[  ÌÍØÝÍHHÉ][ÝÓXÛÛI][ÝË    ][ÝÐ][    ][ÝË  ][ÝÔØYHÚ[X[É][ÝË ][ÝÒÝØØ[[I][Ý×BÙÐÞ
    ][ÝÐ^I][ÝËÐ^UÔÝ[Ê   ÌÍÜÛÛË    ][Ýß  ][ÝÊH [ÈP    [ÈP    [È [ÈÐ^UÔÝ[Ê  ÌÍØÝ    ][Ýß  ][ÝÊH [ÈP    [ÈP    [ÈBÜÛÜ
    ÌÍÜÛÛË    ÌÍØÝ
BÐ^QÜ^J   ÌÍÜÛÛË    ][ÝÔÛÛÈÛÜYHÛÛÉ][ÝÊBÐ^QÜ^J ÌÍØÝ    ][ÝÐÝÛÜYHÛÛÉ][ÝÊB[ÈÜÛÜ
TY  ÌÍÓXÝÐKTY  ÌÍÔÛ]WÐK   ÌÍÚWÑØÙ[[ÈH  ÌÍÚWÐÙHH   ÌÍÚWÕXÝ[H  ÌÍÚWÑ[HH    ÌÍÚWÔÛÜ[^H
BRYÝÐ^J   ÌÍÓXÝÐJHÜÝÐ^J   ÌÍÔÛ]WÐJH[Ù]ÜLJBRYPÝ[
    ÌÍÓXÝÐJH   ÉÝÈPÝ[
    ÌÍÔÛ]WÐJH[Ù]ÜLBSØØ[    ÌÍÜÛÜÐVÕPÝ[
    ÌÍÓXÝÐJHVÌBQÜ    ÌÍÚHHÈPÝ[
    ÌÍÓXÝÐJHHBBIÌÍÜÛÜÐVÉÌÍÚWVÌHH    ÌÍÓXÝÐVÉÌÍÚWBBIÌÍÜÛÜÐVÉÌÍÚWVÌWHH    ÌÍÔÛ]WÐVÉÌÍÚWBS^WÐ^TÛÜ
    ÌÍÜÛÜÐK   ÌÍÚWÑØÙ[[Ë   ÌÍÚWÐÙK    ÌÍÚWÕXÝ[   ÌÍÚWÑ[K ÌÍÚWÔÛÜ[^
BQÜ    ÌÍÚHHÈPÝ[
    ÌÍÜÛÜÐJHHBBIÌÍÓXÝÐVÉÌÍÚWHH   ÌÍÜÛÜÐVÉÌÍÚWVÌBBIÌÍÔÛ]WÐVÉÌÍÚWHH    ÌÍÜÛÜÐVÉÌÍÚWVÌWBS^T]B[[ÈÏOIÝ×ÜÛÜ

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0