FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Como Ordenar un Array
Posts: 257
Joined: Mon Jun 10, 2013 06:40 PM
Como Ordenar un Array
Posted: Wed Sep 14, 2016 03:57 PM
Un Cordial saludo a Todos.

Ya estuve buscando como hacerle pero no encuentro no entiendo

Les pongo algo de mi codigo por si alguien me echa la mano
Code (fw): Select all Collapse
    aDViaje := ASort(aDViaje,,,{|x,y| x[3]<y[3]})
    REPORT oReporte Title "Listado de Viajes  del :"+Dtoc(oGet[1,2])+" Al "+Dtoc(oGet[2,2]) Center;
                        Header AllTrim(EMPRESA->EMPRESA),AllTrim(EMPRESA->CALLE)+", COL. "+AllTrim(EMPRESA->COLONIA)+" "+AllTrim(EMPRESA->LOCAL)+"                                CP.:"+AllTrim(EMPRESA->CP) Center ;
                        Footer "Pagina # "+str(oReporte:nPage,3)+" -- "+"Fecha :"+Dtoc(Date());
                        Font aFontPrn[01],aFontPrn[02],aFontPrn[25],aFontPrn[25],aFontPrn[34],aFontPrn[37],aFontPrn[01],aFontPrn[14];
                    Caption "Reportes Del Sistema de Administracion" PREVIEW
                Column Title "Nota"                 Data aDViaje[nCont,01]
                Column Title "Fecha"                Data aDViaje[nCont,02]
                Column Title "Empleado"             Data aDViaje[nCont,03] SIZE 25
                Column Title "Imprte"               Data aDViaje[nCont,04] PICTURE "999,999.99" TOTAL
                Column Title "Destino"              Data aDViaje[nCont,05] SIZE 30
                Column Title "Tiempo"               Data aDViaje[nCont,06] 
                GROUP ON {|| aDViaje[nCont,03]}
    ENDREPORT
    oReporte:bSkip := { || nCont++  }   
    oReporte:lAutoLand := .T.
    Activate Report oReporte WHILE nCont <= LEN( aDViaje )


* Creo el Array y lo ordeno por el "EMPLEADO" [3]
* Pero ahora tengo la necesidad tambien de ordenarlo dentro de Empleado por "FECHA" [2]

Saludos...
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Como Ordenar un Array
Posted: Wed Sep 14, 2016 04:10 PM
Casi lo tienes.

Sólo cambia la 'expresión ordenadora' por esta otra:
Code (fw): Select all Collapse
x[3]+ DToS(x[2]) < y[3]+ DToS(y[2])
Posts: 257
Joined: Mon Jun 10, 2013 06:40 PM
Re: Como Ordenar un Array
Posted: Wed Sep 14, 2016 04:35 PM

Gracias mi estimado Amigo

Funcionó como yo quería.

Continue the discussion