Solved

Using a textbox to do a fuzzy lookup

Posted on 2006-11-13
6
507 Views
Last Modified: 2008-02-01
Hi there, the scenario of my problem is: A user can type in a string in a textbox, when he clicks the button the string must be used to do a fuzzy lookup with a reference table. If there is any similarities(where the _Similarity column > 0) between the string and a reference table it must show the fuzzyresults in a datagridview below the textbox.

Thanks.
0
Comment
Question by:cErasmus
6 Comments
 
LVL 2

Expert Comment

by:amiableansari
ID: 17929209

take a datatable and fill it with something that you want to show in datagrid

mDT = new DataTable();
mAdapter.Fill(mDT);                  
dgTest.DataSource = mDT;

now when the user clicks on the button make a dataview and add a filter expression and assign it to the datagrid.

private void button1_Click(object sender, System.EventArgs e)
{
        DataView mView = mDT.DefaultView;
      mView.RowFilter = "ur_ref_fieldname like '" + textBox1.Text + "%'";
      dgTest.DataSource = mView;
}

0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 17929435
I think you missed another wildcard character before the text.

     mView.RowFilter = "ur_ref_fieldname like %'" + textBox1.Text + "%'";

_______________

  Nayer Naguib
0
 

Author Comment

by:cErasmus
ID: 17929436
I tried this, but like is not going to work for me. You see I want to, lets say a guy wants to buy a product, but first he has to check his stock so he enters the product's name, lets say he wants to buy a "Brown glasshouse" so he enters it. Now I check in stock, and in my stock I have "Brown glasscasing". Is this possible? I would like to use something like this in a front-end program? Doing a fuzzy search outside of SSIS?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Accepted Solution

by:
tobydavid earned 500 total points
ID: 17932015
You might find Levenshtein Distance useful.  This is a measure of (dis)similarity between two strings based on the number of changes it would take to turn the first string into the second.  Here is a good source of additional information

http://www.merriampark.com/ld.htm

It also contains the code you would need for either Java, C++, or Visual Basic
0
 

Author Comment

by:cErasmus
ID: 17954502
Thanks, but I already solved it, i'll still reward you.
0
 
LVL 4

Expert Comment

by:tobydavid
ID: 17955499
Thank you.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now