Hi all,
I need to order a multidimensional array with two criterias.
Is there a way to make an order this I use for a dbf sort on lb02/a,lb11/a to &filelb on an Array using asort ?
Thanks in advance.
FUNCTION mFaSo2Dim(mAr,mColumn,mL,mR) // fast sorting of two-dimentional array mAr
// mAr - array to be sorted
// mColumn - column array to be sorted on
// mL - index of the first element of area to be sorted
// mR - index of the last element of the area to sort
//Function returns Nil
Local mSrtFlg,mI,mJ,mX,mW,mV,mT
if mL=nil; mL=1; endif
if mR=nil; mR=len(mAr); endif
if mR>1
mSrtFlg=.t.
mI=mL
mJ=mR
mX=mAr[(mL+mR)/2,mColumn]
Do While ((mI<mJ).or.mSrtFlg)`
mSrtFlg = .f.
Do While (mAr[mI,mColumn]<mX)
mI++
EndDo
Do While (mAr[mJ,mColumn]>mX)
mJ--
EndDo
If mI <= mJ
mW = mAr[mI]
mAr[mI] = mAr[mJ]
mAr[mJ] = mW
mI++
mJ--
EndIf
Loop
EndDo
If mL < mJ
mFaSo2Dim(mAr,mColumn,mL,mR)
EndIf
If mR > mI
mFaSo2Dim(mAr,mColumn,mL,mR)
EndIf
Endif
RETURN Nil
Marco Turco wrote:Hi all,
I need to order a multidimensional array with two criterias.
Is there a way to make an order this I use for a dbf sort on lb02/a,lb11/a to &filelb on an Array using asort ?
aSort( aArray,,,{|x,y| If( x[1] == y[1], x[2]<y[2], x[1]<y[1] ) } )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 117 guests