Order an array

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Order an array

Post by Silvio.Falconi »

I have this array

Image

AaDd(atemp,{strzero(n,4),;
SP->elemento,;
SP->desc,;
SP->settore,;
nGiorni,;
aPrices[k],;
lIslock,;
aListini[k][2] } )

the user found problems to modify the price and he wish see before specific strings (col2+col4)
before all "Ombrellone" and sectors
then all "Palma" and sectors
and then all "Cabina" and sectors


I made ASORT( aData,,, { |x,y| x[3] } ) but not run ok
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Order an array

Post by ADutheil »

Try something like this: ASORT( aData,,, { |x,y| x[3] < y[3] } )
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Order an array

Post by Silvio.Falconi »

thanks
this ordered on alphabetic order on first column
"Cabina" then "Ombrelone" then "Palma"
I found a solution with ASORT( aData,,, { |x,y| x[3] > y[3] } )
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply