Home
TeamSite
Preventing Duplicates
kuruption213
Is there any way to prevent duplicates from entering the database based on looking at the profile data (e.g. documents with the same description name and the same docuemnt type) or anything else.
Or should I just write custom logic in the NewProf.nrs file.
Thanks
Find more posts tagged with
Comments
guido1
There's nothing for general profiled documents that is supported natively by the WorkSite API that I'm aware of, other than of course the duplicate detection for emails which relies on the RFC822 internet message ID
I'm wondering why you have this business requirement?
Also, if you do end up going down that path, I think it would be extremely difficult to implement in the real world. For example, how will you deal with new versions of the same document? Will you disallow them to have the same profile description (the default option)? Or just disallow new versions (a bit extreme!)
If you have some other mechanism of uniquely tagging a document you could save that unique ID (a GUID maybe) into one of the custom profile fields if you have any spare. You could then try performing a search before the profile is created to see if that unique ID is already present
kuruption213
Thanks for your reply. They want to ensure that documents with the same name do not go into the database if they are a new document. So therefore this logic would only go into the NewProf.nrs script. They want a message to warn the user that a document with the same name exists in the repository. If it does the user will do a search for the document and then determine if indeed it is the same document. If it is the user should not be uploading the document as a new document, otherwise if it is different it should be named something else.
I would like to do your suggestion of performing the search before it goes in does anyone know which methods I should be looking at? It appears that the NRTSearchParameters method is only available within the SearchDlg.
kuruption213
I'm currently working on trying to get into the database from my NewProf.nrs script where I can then do a search on the document description. However I'm having problems connecting to the correct database. I have a server with 2 worksite databases and when I do a count only 1 is returned and when i do a name for that database it is not the database I want to connect to. What am I doing wrong? Is there something I need to set on the second database so that it gets recognized in the databases?
'find documents that contain the same document name in the same libraray.
Dim objDMS
Dim objSess
Dim objDB
Set objDMS = CreateObject("IManage.NRTDMS")
Set objSess = objDMS.Sessions.Add("WDCVDMSD1")
objSess.TrustedLogin()
Set objDB = objSess.Databases
MsgBox(objDB.Count)
kuruption213
I forgot to add that if I take out the TrustedLogin and replace with Login username, correctdbpassword (the users are the same in both databases, but they have different passwords for each db). then i get to the correct database. Why does trustedlogin only take me to one database and not the other?
guido1
The TrustedLogin method uses network authentication, so its behaviour will depend on how you've set up your users in the WorkSite Db Admin tool
Did you set these users up as "virtual" users with different passwords in each database? If so it sounds sensible that you would see different results between an explicit Login and a TrustedLogin
I have to ask: why are you creating a new session within your script? Is it because you'd like to login under a different account to perform the search?
kuruption213
Yes I am using Virtual users and I was planning on logging in as a different user to do the search but now I'm thinking that may not be the best approach. I just want to see if a document with a document fitting the description exists then I simply would not prevent the upload.