App Connect Form Validator Support Product Page

How do i check for a duplicate database record based on two fields rather than just one?

5 years ago Bruce Wilkie posted:
Hi there

I'm wanting to check for duplicate records based on two fields rather than just one.
I need product names to be unique but only within a product category. So two products in different categories can have the same name in the database.
So when adding a record to the products database I'd like to check if the categoryid is the same AND the productname is the same as a product already in the products table, then validation fails.
How do I do this?
I can't see how using the Form Validator window.

Replies

Replied 5 years ago
5 years ago Teodor Kuduschiev replied:
You cannot use the form validator for this.
Use a database query, filter it by the name/category and if it returns a value, then the record exists.
Add a condition after the query, use the query as a expression for the condition.
In the then step add a response which can be used on the front end to show error
In the else step add your database insert ... when the record does not exist.

Reply to this topic