Storing and searching for names like O'Brian

I’m looking for a suggestion on how to store and search for names like “O’Brian.” I’m having trouble with users entering names using straight or curly single-quote apostrophes, and then when searching, you don’t know which they used.

I could standardize the name to straight (or curly), but then I’d be changing how a user’s name is displayed. Maybe this isn’t a big deal, but a lot of users have put their names in with curly quotes. On a Windows machine, I don’t even know how they managed that.

I can come up with solutions but they’re either clunky or change user data. I’m hoping someone has a real-world suggestion to this issue.

Thanks,
Tim

1 Like

Hi @Tim_Jones,

When saving data to the database, you can replace all quotes with 1 option that suits you using the replace function. As a result, you will have all the names in one format. The same method can be used for searching, when entering a name, use the replace function to replace all quotes with 1 option that suits you. If this method does not fit you, write the steps with the expected result so that we understand your problem in detail and can help you.

Regards,
Bohdan

Hi @Bohdan_Vynarchuk,

I was thinking the same thing, but it is changing the display of someone’s name. They put in a curly quote, and they get a straight quote in the display, which feels a little weird.

Tim

@Bohdan_Vynarchuk

It turns out I am already replacing curly with straight apostrophes, but I have never updated the existing data.

Can I use an inline update like this?

Thanks,
Tim

Hello @Tim_Jones

You can use this update. Does it solve your problem?

Regards,
Inna

Thank you @Inna_Shkolnaya and @Bohdan_Vynarchuk for the help.

I updated the data in my table to replace all curly with straight apostrophes. I appreciate your help working through the issue with me.

Best,
Tim

Just kidding, the update didn’t work.

I ran this code -

The result shows a matching number of rows updated, but the names don’t actually get updated -

image

Tim

I broke out the update into two steps. I wish everything didn’t require so much thinking. Being able to write a simple SQL statement would be very welcome for updates like this.

Tim

Hi @Tim_Jones

Yes, to update all records you need to load them first, then modify and save them on the server using BulkUpdate API or save records one by one.

We do not provide a way to run raw SQL because of technical specifications in the design that work with relations/roles/permissions, etc.

Regards,
Vlad

Thanks, @vladimir-upirov.

Tim

1 Like