SortArray / ScanArray
SortArray(aArray,[nStart],[nCount],[lAscending],nColumn); ScanArray(aArray,xValue,[nStart],[nCount],nColumn)Sorts and searches arrays in historical eAdvPL.
Overview
SortArray receives range, Boolean direction and column; ScanArray receives expression, range and column and documents a position or zero. The guide has errors: SortArray return repeats search text, while aSize syntax prints ScanArray. We therefore assign no SortArray return or undocumented comparison semantics. The uninvoked block only demonstrates ScanArray with an explicit column. Check ASort and AScan separately for current AdvPL. (Sources: refs. 1–1.)
Syntax
SortArray(aArray,[nStart],[nCount],[lAscending],nColumn); ScanArray(aArray,xValue,[nStart],[nCount],nColumn)Return value
ScanArray: position or zero; source SortArray return is inconsistent.
Commented example
#Include "Protheus.ch"
User Function Ed669()
// eAdvPL reference; distinguish from current AScan.
Local bSearch := {|aRows| ScanArray(aRows,"A",1,Len(aRows),1)}
ConOut(ValType(bSearch))
Return NilCreates block B; performs no sorting or searching during this execution. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Verify platform and handle zero before indexing. Test empty lists, partial ranges and row shapes.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.