Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to understand ASCAN()
Message
From
16/03/2008 18:15:26
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01302521
Message ID:
01302530
Views:
16
This message has been marked as the solution to the initial question of the thread.
>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform