Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WestWind/database filter help
Message
From
10/09/2011 02:55:18
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
09/09/2011 14:43:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01516279
Message ID:
01523139
Views:
61
>I've since gotten this to work the way I intended, but I wanted to update it to allow the user to search on two different fields if need be. How can I make it also look to another variable for the searching like the code below?
>
>
cmd = [exec InTransitRN ?']+fdBlNo+[']
>
>So basically I want them to be able use the above if they have that number, but also search on this one:
>
>
cmd = [exec InTransitRN ?']+fdRefNo+[']
>
>Is there a way to combine the two somehow or does it have to be done separately? Would a CASE statement work here? I was thinking of having it check to see which text box had data in it and use the associated code based on that. I don't know if that's a good way to do it though.

This is where using an SP is actually an obstacle, because you have only the parameters it has. If you were doing SPT, you could build the where clause on the fly... something like this:
lcWhere=""
if not empty(fdblno)
  lcWhere=lcWhere+" blNo=?fdblno and "
endif
if not empty(fdRefNo)
  lcWhere=lcWhere+" blRef=?fdRefNo and"
endif
lcWhere=lcWhere+" 1=1"     && or you can use your own dirty trick to deal with the last "and" or empty lcwhere
sqlexec(handle, lcSql+" where "+lcwhere, "youralias")
This is assuming that you already have the query in the lcSql variable.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform