Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASCAN() 1

Status
Not open for further replies.

ariftvt

Programmer
Aug 25, 2008
18
AE
How to search a purticular COLUMN in a MultiDimensional ARRAY.?

 
What version of VFP?

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
After I asked I remember (but not sure) that ALL version of VFP since VFP6 (the oldest version I use) have this syntax:
Code:
ASCAN(array, item searched, starting number, elements to search, searched column)

so, if you want to search in column 2:
Code:
ASCAN(array, item searched, 1, -1, 2)

Just remember that if you use version smaller that VFP8 this syntax returns you the element number as a one dimensional array. You should use ASUBSCRIPT() function to return you the row number. If you have VFP8 or 9 you should check in last parameter for that function (nFlags).

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 

Borislav,
ASCAN in VFP6 doesn't have searched column parameter.
Not sure in what version it was added, but VFP6 syntax is:

ASCAN(ArrayName, eExpression [, nStartElement [, nElementsSearched]])

 
Then it is time to upgrade :)

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 

I wish.

In a corporate environment, I can't just buy and install my own software - and failed many times over to prove to the higher ups that we need it. I gave up.
 
FWIW before we had the "column to search" parameter of Ascan(), almost every VFP developer had a UDF in the toolbox called AColScan() or something like it.

It's not that tough to write.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top