>Could someone explain why the following does not find an element?
>
>
...
>nEle = ASCAN( aTest, "XXX", 9, -1, 2, 0 )
>
>WAIT WINDOW " found XXX in elem " + ALLTRIM(STR( nEle ))
>
>*-- The nEle returned in 0
>
>
>I thought that above expression should look for value "XXX" in the second column of two-dimensional array, starting with element 9. I thought it would find the element aTest[6,2] but it does not.
>
>What am I missing?
Help for aScan() says this about nSearchColumn:
"If you use a value greater than 0 for nSearchColumn, ASCAN( ) treats the specified column as a one-dimensional array, using each data row as an element in the search. "
Which means that it won't find a thing because you basically told it to start from 9th row in a 6 row array. If you keep nSearchColumn at -1 (or 0), then aScan() searches all columns and the the 3rd parameter means element-in-whole-array. Since you specified a value for nSearchColumn, the 3rd parameter is taken to mean "element in that column". Try with a 4, 5 or 6 instead of 9.