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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use INLIST command

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
GB
I have some code similar to below. If I use the inlist command like INLIST(LEFT(Forename,1),"A","B","C"), everthing works fine. However if I have a variable for the letters (ie sINLIST = "A,B,C") only the first letter is reconnised. All forenames beginning with B and C are ignored. This needs to be a variable as I want the operator to be able to choose the Forenames they want to pick (ie beginning with A,B,D etc...)

Example below only shows Forenames begginning with C. I want C J and B.

sINLIST = "C,J,B"
lcFilter = 'INLIST(LEFT(Forename,1),sINLIST)'

lcFields = SUBSTR(lcFields,2)
lcFilter = SUBSTR(lcFilter,8)

SELECT &lcFields ;
FROM cp_score, cp_member ;
WHERE &lcFilter ;
INTO TABLE test
 
Hi bebbo,

try

lcFilter = 'INLIST(LEFT(Forename,1),'+sINLIST+')' Andrea C.P.
Italy [atom]
 
Hi

INLIST(cWanted,cSearched1,cSearched2...)
where cSearch1, cSearch2 are the expressions to be searched.
A maximum of 24 such expressions can be searched.
These cWanted and other expressions can consist of more than one character.

SO if you look..
? INLIST("CAT","RAT","MAT","CAT").. will return .t.

IN YOUR CASE YOU ARE WANTING TO LOOK FOR ONE CHARACTER. THE BEST COMMAND FOR THIS WILL BE THE $ OPERATOR.
For example..

sINLIST = "CJB"
lcFilter = "LEFT(Forename,1) $ sINLIST"

This will do the requirement.


ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top