Created
April 13, 2016 14:28
-
-
Save jbratu/5509e0feb38834c413842db148b8046f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function CS_TransposeSort(A, Bys, Justs) | |
Declare Subroutine V119 | |
ARowCount = DCOUNT(A<1>, @VM) | |
AColCount = DCount(A, @FM) | |
ATransposed = '' | |
*Transpose it for use with V119 | |
For Rows = 1 To ARowCount | |
RowTransposed = "" | |
For Cols = 1 To AColCount | |
V = A<Cols, Rows> | |
RowTransposed<-1> = V | |
Next | |
ATransposed = ATransposed : RowTransposed : @RM | |
Next | |
V119('S', '', Bys, Justs, ATransposed, '') | |
RMCountAfter = Count(ATransposed,@RM) | |
*Swap out the sorted results for easier use | |
ATransposedDebug = ATransposed | |
Swap @SVM With @TM In ATransposedDebug | |
Swap @VM With @SVM In ATransposedDebug | |
Swap @FM With @VM In ATransposedDebug | |
Swap @RM With @FM in ATransposedDebug | |
AReconstructed = "" | |
SkipOffset = 0 | |
*Reconstruct back into array format | |
For Rows = 1 To RMCountAfter | |
RowTransposed = Field(ATransposedDebug,@FM,Rows) | |
If Trim(RowTransposed) == "" Then | |
SkipOffset += 1 | |
End Else | |
For Cols = 1 To AColCount | |
V = RowTransposed<1,Cols> | |
TransposedRowPos = (Rows - SkipOffset) | |
AReconstructed<Cols, TransposedRowPos> = V | |
Next | |
End | |
Next | |
Return AReconstructed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment