Como Ordenar un Array

Como Ordenar un Array

Postby VitalJavier » Wed Sep 14, 2016 3: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: Select all  Expand view

    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...
User avatar
VitalJavier
 
Posts: 239
Joined: Mon Jun 10, 2013 6:40 pm

Re: Como Ordenar un Array

Postby hmpaquito » Wed Sep 14, 2016 4:10 pm

Casi lo tienes.

Sólo cambia la 'expresión ordenadora' por esta otra:
Code: Select all  Expand view
x[3]+ DToS(x[2]) < y[3]+ DToS(y[2])
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Como Ordenar un Array

Postby VitalJavier » Wed Sep 14, 2016 4:35 pm

Gracias mi estimado Amigo

Funcionó como yo quería.
User avatar
VitalJavier
 
Posts: 239
Joined: Mon Jun 10, 2013 6:40 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Willi Quintana and 50 guests