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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Similar Strings

Status
Not open for further replies.

chrissypchy

Programmer
Jun 23, 2003
40
US
Hi Everyone,

I am doing something for work where I need to count instances of strings. The strings are similar except for the dates and times in the strings that change. Is there any formula or any way to make it so that I can count strings that are similar? Thanks.

-Chrissy
 
How about some examples of the strings? If you had a string where the date always started in a certain position, let's say the 8th position, and you wanted to count those strings in which characters 1 to 7 were the same, you could create a formula like this:

left({table.string},7)

And then group on it, and insert a count on the details within the group.

-LB
 
Hi LB,
Thanks for the help. The thing is that the strings vary a lot where I couldnt take any certain positions. I know in SQL, we have a "like" type of thing where we could compare similar strings. Do you know if there is anyway in Crystal Reports that it can be done?
-Chrissy
 
Yes, there is a "like pattern" operator, but can't tell how well it would work for you without any information on your string. Why not share a few examples? There are methods that don't rely on absolute position...

-LB
 
You can use a Like in Crystal too, but a like would be used to select data, not group it.

But like might only be used to identify similar ones if you can state what part to omit or include.

One approach might be to use a soundex function to group data, but as LB states, you have to better identify what constitutes a *like* element.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top