Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameterized IN
Message
From
23/04/2009 12:48:31
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01396004
Message ID:
01396099
Views:
73
Perhaps I didn't explain it properly. I don't want to build a user interface which gets the names of the employees and then passes them to SQLEXEC(). I want to find some way for the SQLEXEC() statement to see the need for an input variable and then evaluate it properly as the arguements for IN().

Same question from a different angle.

Let's say I'm working in the View Designer. I've set up my Field List and Join and now I'm working in the Filter Tab. I select a field (employee) and make the criteria IN. When I USE the view, I want to be able to enter a list of employees that will be evaluated for IN().
I haven't been able to find anyway to get more than the first name to be part of the result set.

Sorry if I wasn't clear enough. I hope this explanation is better.

........Rich


>You've to use a combination of SPT parameter and macrosubstitution.
>
>lcEmpList = ["NAME1","NAME2"]
>lcQuery = "SELECT * FROM myTable WHERE employee IN (?&lcEmpList)"
>lnRetval = SQLEXEC(lnConnection, lcQuery, "crsResult")
>
>I moved a query out for clarity.
>
>>
SQLEXEC(lnConnection,"SELECT * FROM myTable WHERE employee = ?emp")
>>
>>pops up a little dialog box and allows entry of a name to search against.
>>
>>I want to use the same functionality with IN
>>
>>
SQLEXEC(lnConnection,"SELECT * FROM myTable WHERE employee IN (?emp)")
>>
>>If I put in
NAME1,NAME2
I get nothing back
>>If I put in
"NAME1","NAME2"
I get just the first record
>>
>>How can I format the dialog response (or how else can I set up the query) to get the two (or any number of) names
>>
>>(I'm sure there are lots of other ways of doing this, but all I'm really interested in is how to do this with the parameterized query.)
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform