"Does Not Exist in Database" server validation

Dear Wapplers,

I need some confirmation.

I have a server validation that is supposed to prevent Products with the same name from being registered. However, to my surprise, I managed to register two products with the same name:

Volkswagen Golf GTI
Volkswagen Golf gti

Please, don't tell me this “check existing entry” validation isn't case-insensitive... with no option for that…

convert both to lower case using the formatter and then compare the two lower case names….

I can use the formatter in the field definition, but I can't do the same in the rule definition:

Have you considered the option to add a UNIQUE constraint to the product name column?

Yes, and technically that would work from a data integrity standpoint.

But it would break the user experience, as they receive field validation via "red messages under each field"—which is exactly one of the most useful aspects of the validation feature.

Converting the data to lowercase before inserting it into the database would be another approach, but product names have specific casing that carries meaning. If a product is named "MSFT - Double Decker Truck GT," it must be displayed exactly like that, and that formatting would be lost if I applied this formatting.

Correction: a UNIQUE constraint won't help me... because Postgres is also case-sensitive.

Maybe a custom query? Use a condition
If query.length()>=1 then value exist

I think using ILIKE is not case sensitive, but don't remember


I know it's weird, but what about a repeat action that recreate the value in a new column where you have the same data in lowercase?

1 Like

A new column to store the product name in lowercase? I can do that... Of all the solutions I’ve been considering, it’s the simplest one... and it works.

It’s a shame the validation doesn't have a "case-insensitive" option...

Thanks for the insight, mate!

1 Like

Why not create a feature request? This problem will affect everyone who uses the validator (myself included) so it makes sense to have it added as a feature if this is possible.