Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INLIST() with variable?
Message
De
19/10/1999 18:41:54
 
 
À
24/08/1999 12:24:15
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00256667
Message ID:
00278533
Vues:
17
>>site = 'HSC'
>>This works:
>>?inlist(site,'xxx','HSC') && returns .T.
>>
>>This does NOT work:
>>clist = "'xxx','HSC'"
>>?inlist(site,clist) && returns .F.
>>
>>I need to have a dynamic list (e.g. clist = ...) so that
>>I can use this code to conditionally delete records. Not
>>sure why this will not work.
>>
>>Any ideas or alternative solutions?
>Why doesn't work and how would work has already been told at its best.
>Alternative solution might be SQL delete. As I read your "conditionally delete" I sensed you first do an SQL to collect the list :)

The following will work:

clist = "'xxx','HSC'"
? inlist(site,&clist)

or

cListOfTestVals = "'xxx','HSC'"
cCmdExpn = "inlist(site," + cListOfTestVals + ')'
? &cCmdExpn

or even better, unless it's being evaluated multiple times, in which case macro expansion once is cheaper than many EVAL()s. The macro expansion is cheaper in a FOR or WHERE clause that's executed against a set of records, where EVAL() would have to fire for each record, but macro expansion would only fire once, with the resultant expression code executed against each record instead.

cListOfTestVals = "'xxx','HSC'"
? EVAL("inlist(site," + cListOfTestVals + ')')
? &cCmdExpn


>Cetin
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform