Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Substring search with Parm View?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00170654
Message ID:
00171135
Views:
33
I have to take a break from working and thank you all!

Everyone who is new to Fox (or migrating from FPW to VFP6 like
me), save this email/print it somewhere. You will need to
do some (slow) substring searches because a client has to have
it their way, and you might have to do it with a parameterized
view to boot. Code below has tabs and removed:

Here's my create view code:

Create SQL View Values_OrdProc2_TxtSearchGrid ;
Connection OrdProc4 ;
share ;
as ;
select ;
cItem_No , ;
cTitle , ;
cAuthor , ;
cMedia , ;
cPublish , ;
nWeight ;
from ;
Catlog ;
where ;
upper(cTitle) like (?cUsrFirstChoice) ;
upper(cAuthor) like (?cUsrSecondChoice) ;
upper(cPublish) like (?cUsrThirdChoice) ;
order by ;
cTitle, cAuthor , cPublish

In my form, here's the code behind the click event of my
'Text Search' button:
..yes, I think the code could be tighter...


cUsrFirstChoice =
upper(alltrim(ThisForm.PageFrame1.Page2.txtcSearchTitle.Value))
if empty(cUsrFirstChoice)
cUsrFirstChoice = '%'
else
cUsrFirstChoice = '%' + cUsrFirstChoice + '%'
endif

cUsrSecondChoice =
upper(alltrim(ThisForm.PageFrame1.Page2.txtcSearchAuthor.Value))
if empty (cUsrSecondChoice)
cUsrSecondChoice = '%'
else
cUsrSecondChoice = '%' + cUsrSecondChoice + '%'
endif

cUsrThirdChoice =
upper(alltrim(ThisForm.PageFrame1.Page2.txtcSearchPub.Value))
if empty(cUsrThirdChoice)
cUsrThirdChoice = '%'
else
cUsrThirdChoice = '%' + cUsrThirdChoice + '%'
endif

Requery('values_OrdProc2_TxtSearchGrid')
ThisForm.PageFrame1.Page2.Grid1.RecordSource =
'values_OrdProc2_TxtSearchGrid'
ThisForm.PageFrame1.Page2.Grid1.Refresh
Previous
Reply
Map
View

Click here to load this message in the networking platform