Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot use variable with Inlist()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01009225
Message ID:
01009514
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
Hi Chuck.

The problem here is no that the IIF is evaluating the other extression, but rather that macro substitution works by compiling the line fo code at run time. Since lcValue is empty that evaluates to an illegal function call and so the line can not be compiled.
Probably the best way around this would be to build the entire For clause and macro substitue that.

lcForClause = iif(empty(lcValue), "isdigit(allt(ctag))", "inlist(cTag," + lcValue +")")
Browse for &lcForClause

Ian Simcock


>Sergey
>When trying to run this code:
>
>brow for iif(empty(lcValue),isdigit(allt(ctag)),inlist(cTag,&lcValue))
>
>I get "Function argument value, type, or count invalid". In this instance the value of lcValue is empty. It seems like the IIf() is still evaluating the code. cTag is a field. Any ideas? I have to leave but will check back later.
>
>Thanks, Chuck
>
>
>>It should work. Most likely you've incorrect value for lcValues.
>>
>>>I am trying to do a "brow for inlist(field,&lcValue)"
>>>I get "Function argument value, type, or count invalid"
>>>when I type in the values it works, I don't get it.
>>>
>>>
>>>>>Does anyone know why a variable cannot be used with Inlist(fieldname,lcValues)? Where lcValues = '"DEP 17052","DEP 0944","05232"'.
>>>>
>>>>You've to use micro substitution in this case
Inlist(fieldname, &lcValues)
Previous
Reply
Map
View

Click here to load this message in the networking platform