Author | Topic: Sort one Array of several dimensional | |
---|---|---|
César Calvo | Sort one Array of several dimensional on Thu, 22 Nov 2012 01:06:50 +0100 Hello, I have this array "20111231","20111231","5840000090" "20111230","20111230","5840000080" "20111230","20111230","5840000070" and I want order it for see "20111230","20111230","5840000070" "20111230","20111230","5840000080" "20111231","20111231","5840000090" I mean with first and third element. I hink with Asort but I don´t know. Can you help me? Regards, César. | |
Andreas Gehrs-Pahl | Re: Sort one Array of several dimensional on Wed, 21 Nov 2012 20:02:20 -0500 César, >I hink with Asort but I don´t know. See the second example of ASort() for sorting multi-dimensional arrays: Procedure Main() LOCAL aArray := {{"20111231", "20111231", "5840000090"}, ; {"20111230", "20111230", "5840000080"}, ; {"20111230", "20111230", "5840000070"}} QOut(ASort(aArray, , , {|aX, aY| aX[1]+aX[2]+aX[3] < aY[1]+aY[2]+aY[3]})) return Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas.Gehrs-Pahl@InterAct911.com Andreas.Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
César Calvo | Re: Sort one Array of several dimensional on Thu, 22 Nov 2012 08:14:22 +0100 Many thanks Andreas. I don´t saw that, now yes. Regards, César. "Andreas Gehrs-Pahl" escribió en el mensaje de noticias:1o8xhfus73pr1.1lz4imywh60ja.dlg@40tude.net... César, >I hink with Asort but I don´t know. See the second example of ASort() for sorting multi-dimensional arrays: Procedure Main() LOCAL aArray := {{"20111231", "20111231", "5840000090"}, ; {"20111230", "20111230", "5840000080"}, ; {"20111230", "20111230", "5840000070"}} QOut(ASort(aArray, , , {|aX, aY| aX[1]+aX[2]+aX[3] < aY[1]+aY[2]+aY[3]})) return Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas.Gehrs-Pahl@InterAct911.com Andreas.Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
Osvaldo Ramirez | Re: Sort one Array of several dimensional on Thu, 22 Nov 2012 08:17:39 -0700 On 11/22/2012 12:14 AM, César Calvo wrote: > Many thanks Andreas. > > I don´t saw that, now yes. > > Regards, > César. > > "Andreas Gehrs-Pahl" escribió en el mensaje de > noticias:1o8xhfus73pr1.1lz4imywh60ja.dlg@40tude.net... > > César, > >> I hink with Asort but I don´t know. > > See the second example of ASort() for sorting multi-dimensional arrays: > > Procedure Main() > LOCAL aArray := {{"20111231", "20111231", "5840000090"}, ; > {"20111230", "20111230", "5840000080"}, ; > {"20111230", "20111230", "5840000070"}} > QOut(ASort(aArray, , , {|aX, aY| aX[1]+aX[2]+aX[3] < aY[1]+aY[2]+aY[3]})) > return > > Hope that helps, > > Andreas Remember, if you want sort by first and third position, then change for this : QOut(ASort(aArray, , , {|aX, aY| aX[1]+aX[3]+aX[2] < aY[1]+aY[3]+aY[2]})) Regards | |
César Calvo | Re: Sort one Array of several dimensional on Tue, 27 Nov 2012 06:05:38 +0100 OK, thanks. "Osvaldo Ramirez" escribió en el mensaje de noticias:6ab78a63$1bbf1fb6$c40@news.alaska-software.com... On 11/22/2012 12:14 AM, César Calvo wrote: > Many thanks Andreas. > > I don´t saw that, now yes. > > Regards, > César. > > "Andreas Gehrs-Pahl" escribió en el mensaje de > noticias:1o8xhfus73pr1.1lz4imywh60ja.dlg@40tude.net... > > César, > >> I hink with Asort but I don´t know. > > See the second example of ASort() for sorting multi-dimensional arrays: > > Procedure Main() > LOCAL aArray := {{"20111231", "20111231", "5840000090"}, ; > {"20111230", "20111230", "5840000080"}, ; > {"20111230", "20111230", "5840000070"}} > QOut(ASort(aArray, , , {|aX, aY| aX[1]+aX[2]+aX[3] < aY[1]+aY[2]+aY[3]})) > return > > Hope that helps, > > Andreas Remember, if you want sort by first and third position, then change for this : QOut(ASort(aArray, , , {|aX, aY| aX[1]+aX[3]+aX[2] < aY[1]+aY[3]+aY[2]})) Regards |