Welcome Guest, Not a member yet? Register   Sign In
is_unique for multiple values
#1
Question 
(This post was last modified: 02-01-2024, 08:18 AM by joho.)

I have a unique (and primary) key, call it "record_id". It's an arbitrary string.

Along that column, I have "owner", "name", and "URL", all of these are varchar fields. "owner" has an index.


I wanted to create a validation rule that basically says:

"name" and "URL" must be unique, for the same "owner".


So, if I have these values:

record_id = "aaa", owner = "joho", name = "This is a test", URL = "https://domain.com"

I want the validation rule to allow another owner to have a similiar record like this:

record_id = "ccc", owner = "notjoho", name = "This is a test", URL = "https://domain.com"


But I don't want the user "joho" or the user "notjoho" to be able to create another record with the same name and/or URL.

But I cannot for the life of me figure out what that "is_unique" construct would look like in a validation rule.
Is this even possible?

-joho
Reply
#2

(This post was last modified: 02-01-2024, 07:39 PM by kenjis.)

No , you can't.
Create your own rule.
https://codeigniter.com/user_guide/libra....html#id39
Reply
#3

(02-01-2024, 07:37 PM)kenjis Wrote: No , you can't.
Create your own rule.
https://codeigniter.com/user_guide/libra....html#id39

Thanks for responding. I ended up doing just that.

-joho
Reply




Theme © iAndrew 2016 - Forum software by © MyBB