Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Soundex formula won't work? 1

Status
Not open for further replies.

ynott

Technical User
Sep 26, 2000
49
US
I'm trying to build a soundex formula in my last name and first name selection statement. Unfortunately, I'm using the example in CR 8.0 and can't get it to work. Here's their example:

If Soundex{customer.LAST NAME} = Soundex ("Snider") Then
{customer.LAST NAME}
Else
""

Here's what I used:

If Soundex{PERSONS.prsn_last_name}= Soundex ("Snider") Then
{PERSONS.prsn_last_name}
Else
""

Unfortunately, I get an error message saying that the "then" is missing and the insertion point defaults to just after the first Soundex.


Any ideas? Anyone get this to work right? Has anyone used their own formulas to create a better soundex than Crystal Reports provides.

Thanks
 
It is bad when the example gives bad syntax. The field name needs to be in parentheses. Try:

If Soundex ( {PERSONS.prsn_last_name} ) = Soundex ("Snider")
Then {PERSONS.prsn_last_name}
Else "" Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Ken, thanks

However, I had already tried that formula assuming the same thing:

If Soundex ( {PERSONS.prsn_last_name} ) = Soundex ("doe")
Then {PERSONS.prsn_last_name}
Else ""

Unfortunately, I received the following error:

"The result of the selection formula must be a boolean
 
That is correct, a selection has to be a Boolean, so you don't need the if-then. But you still need the parens with the function. Try this:

Soundex ( {PERSONS.prsn_last_name} ) = Soundex ("doe") Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Perfect! Like always, you'd da man, Ken.

Another question just popped to mind to anyone that would like to answer. For the first name, soundex doesn't work well in many cases. For example, soundex on Chris won't get Kris, soundex on Jim won't get James, soundex on William won't get Bill. Is there a standard formula that will also handle this wide range of possibilities?
 
I don't know of a function that can recognize nicknames, but the list isn't that long if you wanted to put the most common ones into an if-then-else statement. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top