Gossamer Forum
Home : Products : DBMan : Customization :

Duplicates

Quote Reply
Duplicates
Is there a mod to keep duplicates from a feild inside of a database? I have a lot of people entering in information and some of it is overlapping.

Quote Reply
Re: Duplicates In reply to
The only check for duplication is of the key field. You can build in other checks for duplicates, but they will have to be on a field by field basis. What fields do you want to check?

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Duplicates In reply to
I would like to have the second field in two of them, called factions, and the second field in the other called systems. Also a name field in one of them.

I have three right now, soon to be 5 databases, and im working on the relationships right now. If you need more info please tell me, i would love to get this up and running

Quote Reply
Re: Duplicates In reply to
Here are a few threads which provide solutions:
Check for duplicate records (multiple)

http://www.gossamer-threads.com/perl/forum/showthreaded.pl?Cat=&Board=DBInst&Number=57420&Search=true&Forum=DBInst&Words=Check for duplicate record&Match=Entire Phrase&Searchpage=0&Limit=25&Old=allposts

Check another field for duplicates
Thead reference:
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/002388.html

These are also both referenced at the FAQ below. I think there may be one of two others within the same topic.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Duplicates In reply to
I have mulitple databases, and those only seemd to work for one database, and then returned errors on the others. is there another method?

Quote Reply
Re: Duplicates In reply to
The only way to do this is to make it specific to your databases.

You need to tell me the name of the .cfg file for each database and which fields you need to check for each one.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Duplicates In reply to
cfg for the first is called 1yb.cfg

I need Name to be checked.

Second one is 666.cfg

I need System to be checked.

They are both in the feild number 1.

Quote Reply
Re: Duplicates In reply to
If they're both field number one, it's a lot easier.

In sub validate_record, after

Code:

if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
add

Code:

if (($db_setup eq '1yb') or ($db_setup eq '666')) {
if ($data[1] eq $in{$db_cols[1]}) {
return "duplicate entry";
}
}


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Duplicates In reply to
I tired that but the names of the 1 feilds are differnt, and it only seemed to pick up on one of them ,and always give me an error on the other.

Quote Reply
Re: Duplicates In reply to
The names of the fields are different, but their position is the same, right? Therefore I can use $db_cols[1] to refer to either one. Or I should be able to, if your fields are numbered correctly.

I'll tell you what. Let's start with one of them. If we can get it to work, we'll go on to the next one.

Code:

if ($db_setup eq '1yb') {
if ($data[1] eq $in{Your field name) {
return "duplicate entry";
}
}
Are these both required fields?

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Duplicates In reply to
ok, did that and now i have both working, so i will attemtpt to add the other databases and see if that works. thanks a lot. on..on the validate thing...got it too, i missed a per_admin in there somwhere....*shrugs* oh well, but now it works. Im high maintence...my girlfriend tells me that all the time

Quote Reply
Re: Duplicates In reply to
In Reply To:
Im high maintence...my girlfriend tells me that all the time
Laugh

I'm glad you got it to work. Smile

JPD
http://www.jpdeni.com/dbman/