Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

String Search Vfoxpro forms

Posted on 2011-09-15
9
Medium Priority
?
419 Views
Last Modified: 2012-06-27
Whenever I produce a form to, for instance, read customer data I've never solved the issue raised by some customers which is.
The user wants to search someone using his name, He doesn't know the complete name but he knows that his name is, at least John Smith. And the user also knows that the customer has some middle name.
Im my form he has to search for all the Johns in my database
But the customer would like John Smith and in the query would be returned all the persons that have John Smith in their name and, of course, John Doe Smith which is the person he's looking for.

How can I configure my search criteria in order to get a narrower search.
0
Comment
Question by:luciliacoelho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 27

Assisted Solution

by:CaptainCyril
CaptainCyril earned 1000 total points
ID: 36541707
SELECT * FROM Client WHERE 'JOHN' $ UPPER(first+middle+last) AND 'SMITH' $ UPPER(first+middle+last)
0
 
LVL 43

Accepted Solution

by:
pcelba earned 1000 total points
ID: 36541710
Many ways exist...

You may split the customer name into three fields: name, surname, and middlename. Then you may search based on text entered into these three fields. If some field remains empty then you have to remove it from the search criteria.

Slower options:
You may search each entered word by using GETWORDNUM() function.
You may use search based on a template using the LIKE SQL operator or LIKE() function.
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 36541722
something like this (I did not test it)


cKeywords = "JOHN SMITH"
cString = " " + cKeywords + " "
cCriteria = ''
FOR i = 1 TO OCCURS(" ",cKeywords)+1
    cCriteria = cCriteria + IIF(i=1,'',' AND ') + '"' + STREXTRACT(cString, " ", " ", i) + '" $ UPPER(first+middle+last)'
ENDFOR

SELECT * FROM Client WHERE &cCriteria
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:jsrebnik
ID: 36548807
although all of the above suggestions will work, pcelba's suggestion about splitting the field into 3 fields and then indexing the fields would provide the fastest search option.  how large is the table?
0
 

Author Comment

by:luciliacoelho
ID: 36553302
Tables are not too big. i would say no more than 11 or 12 Mbytes

Best regards
0
 
LVL 2

Expert Comment

by:jsrebnik
ID: 36554198
I was more intersted in the number of records.  the larger the number of records, the more you'll benefit from indexing.
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 36558497
I had these size of files containing memo fields and without indexing I managed to get all the searches very fast:

1) Case Search
2) Multiple keywords search
3) Exact sentence search
...
0
 

Author Comment

by:luciliacoelho
ID: 36590452
my tables do not have more than 70.000 records
0
 
LVL 43

Expert Comment

by:pcelba
ID: 36591898
Even 70.000 could be too many in some slow network environments. If you are searching 70.000 records in local data on a standalone computer with a few gigs of memory then it is OK.

Indexes and appropriate query parameters will always speed the processing up.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question