Skip to Content
0

Finding the closest matching record to a string

Mar 27, 2017 at 02:20 PM

73

avatar image
Former Member

I need assistance with matching the closest matching record. My requirment in short is I have an internal table that has about 10 records that are name of cities. A user will type in a string and I have to get the record with most letters matching to the supplied string Example:

|Itab

1 |Cape Town

2 |New York

3 |Johannesburg

So if a user types in "huhannesbarg", this string should be matched to Johannesburg as the closest matching record. I will really appreciate your assistance if you experts can maybe provide a function module I can use or just code

Regards Dzuni

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Horst Keller
Mar 27, 2017 at 03:08 PM
5

Check out the built-in function distance.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks, managed to use this and it worked perfectly

1
Richard Harper Mar 27, 2017 at 03:56 PM
1

Closest match in another sense - Use the SoundEx() function to determine if two cities sound like each other when spoken out loud.

<g>

Rich

Share
10 |10000 characters needed characters left characters exceeded