Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INLIST not working ?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00670017
Message ID:
00670018
Views:
22
Kind of struggling to follow the code, but it appears you are incorrectly using INLIST.


* Check if value a is in b, c, d, e, or f
?INLIST(a, b, c, d, e, f)

So if you have a variable lKeyList = "1, 2, 3, 4, 5"
and a varaible lKey = 3

you need to do something like


cCmd= "INLIST(lKey, " + lKeyList + ")"
&cCmd



>Hi, I am using INLIST() function to check whether any of my key is
>in my lKeyList, but it is not working for me, below is part of my
>code that I cut out for testing and is not working too.
>
>Inside admin.dbf, there are record of 100,128,100 and 102
>Please kindly comment why I not getting inlist() to work ?
>
>
>SET DELETED ON
>gDstDir = "d:\winprog\pdatask\data\"
>
>lKeyList = ""
>USE (gDstDir+"admin.dbf") IN 0 ALIAS adm
>SELECT adm
>GO TOP
>DO WHILE NOT EOF("adm")
>
> lKey = ''
> lKey = ALLT(STR(adm->keybrd))
>
> IF NOT EMPTY(lKey)
>
> Messagebox("Checking keylist = "+lkeylist+", with current key = "+lkey)
> IF NOT INLIST(lKeyList, lkey)
>
> Messagebox("Not in list")
>
> IF EMPTY(lKeyList)
>
> Messagebox("Key list empty")
>
> lKeyList = lkey
>
> Messagebox("New key list is now : "+lkeylist)
>
> ELSE
>
> Messagebox("Before append Keylist = "+lkeylist)
>
> lKeyList = ALLT(lKeyList + "," + lKey)
>
> Messagebox("After append, New Keylist = "+lkeylist)
>
> ENDIF
> ENDIF
>
> ENDIF
>
> SKIP +1 IN adm
>
>ENDDO
>USE IN adm
>
>messagebox("The final keylist = "+lkeylist)
>
>CLOSE DATA ALL
Previous
Reply
Map
View

Click here to load this message in the networking platform