?
Solved

Using a textbox to do a fuzzy lookup

Posted on 2006-11-13
6
Medium Priority
?
513 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
[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
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
 
LVL 1

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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 4

Accepted Solution

by:
tobydavid earned 1500 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
 
LVL 1

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

762 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