Solved

Set the DocumentUnique ID of a document...

Posted on 2002-04-26
14
227 Views
Last Modified: 2013-12-18
Is it possible to SET the documentUniqueID of a document ?

The reason I want to do this:

We have a database with documents in it that refer to each other using the documents Unique ID (doclinks). These doclinks are present in a FIELD.
I must split this database, so I have created a copy of this database, changed the functionality a bit and want to copy the documents into the new database (not all of the documents, only the documents that are needed in this new database)
Now all the doclinks arent't working anymore, because during a copy and paste action, the DocumentUniqueID of dcoment is changed.

I though to create a agent that get the value of the FIELD and reset the documentUniqueID to it's old value.

Is this possible ?

Greetings,

Bob
0
Comment
Question by:oosterbaan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 4
14 Comments
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6970826
YES its possible.... If you know the document unique IDS...

You can Set the documents unique ids using script. Recently HemanthaKumar wrote a script to set the document ids while copying the documents to another database here is that code.

Sub Initialize
    Dim s As New NotesSession
    Dim db, tdb As NotesDatabase
    Dim coll As NotesDocumentCollection
    Dim doc, cDoc As NotesDocument
    Set db = s.CurrentDatabase
    Server = db.Server   'target server
    FilePath = "**********target Database Path********"
    Set tdb = New NotesDatabase(Server,FilePath)     ' TargetDatabase
    Set coll = db.UnprocessedDocuments
    Set doc = coll.GetFirstDocument
    While Not doc Is Nothing
         Gosub CopyToTargetDB
         Set doc = coll.GetNextDocument(doc)
    Wend
    Exit Sub
CopyToTargetDB:
    Set cDoc = tdb.CreateDocument
    Call doc.CopyAllItems(cDoc)
    cDoc.UniversalID = doc.UniversalID
    Call cDoc.Save(True,False)
    Return
End Sub

I know you are looking for something different. I am pasting this so that you get an idea on how to set the doc id to a document. Got it ?

More details just post a comment...

Best Wishes!
Arun.

0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6970870
I don't like that code, because there's a GoSub command in there. Yikes, bad programming, Arun :-)

In stead use a subroutine or in this case, just put the code inside the loop, since it's really not that complicated.

Just wanted to write a comment here to annoy Arun. >:-D
0
 
LVL 9

Accepted Solution

by:
Arunkumar earned 50 total points
ID: 6970897
:-)  I know you Jerrith !
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:oosterbaan
ID: 6971077
Sorry....pushed the wrong button !!!!
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6971121
O Bob, Ouch, that's gotto hurt :-)
ROTFL
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6971131
You mean the grading of C is the wrong button ? You can request the community support to give an "A" for me if you wish...

:-)
Jerrith did you fall down to the floor ?
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6971163
I'm just in a it's-nearly-weekend-mood.
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6971176
What I can do is to create a agent in the "old" database that will add a field in the documents with the DocumentUniqueID in it. Then copy the documents to the new database and run a agent that will copy the value of this field as DocumentUnique ID....

Isn't this a great idea ?

Isn't this a simple agent....? (not for me, since i have no knowlegde of lotusscript)

Greetings,

Bob
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6971183
No...you will be graded with a A, but not some more info (-:
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6971186
Try it agin, but now slowly....

No...you will be graded with a A, but NEED some more info *LOL*
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6971375
What more info you will be needing ?Let me know...

:-)
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6972309
Please, show me the LotusScript code for this ?

Read the value from the FIELD in the form and put this as documentUIniqueID

Thx...
Greetings,

Bob
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6972950
Hey Bob,
Run the agent in your new database on all documents in the database and modify the code Arun gave as follows:

Sub Initialize
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim coll As NotesDocumentCollection
   Dim doc As NotesDocument

   REM Get the documents to be processed
   Set db = s.CurrentDatabase
   Set coll = db.UnprocessedDocuments

   REM Loop through all documents in the collection
   Set doc = coll.GetFirstDocument
   Do While Not doc Is Nothing
        REM Set the documents UniqueID to the value found
        REM in the field 'NameOfTheField'.
        REM As you probably know, you always have to use an
        REM index to reference to the value of a field, that's
        REM what the (0) after the name of the field is for.
        doc.UniversalID = doc.NameOfTheField(0)
        Call doc.Save(True,False)
        Set doc = coll.GetNextDocument(doc)
   Loop
End Sub

Have a nice weekend !

JM
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6973115
Hi JM,

This didn't worked... When I start the agent, it creates a copy of the document with the new DocID..Proberbly my fault (-:

Can the agent be much more simple, so I can understand what I'm doing...

Can't I create a agent that whill run on the selected document that will only do something like this ?


       doc.UniversalID = doc.NameOfTheField(0)
       Call doc.Save(True,False)
     
I have created this "simple" agent, but Error messages occur (ofcourse) about Variants and Objects (-: not defined....

What do I need to define to let this simple agent run ?

Thanks,

Bob


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Email Message Background Color 4 150
Domino Lotus Notes Client 4 75
Access VBA to send PDF attachment from C Drive using Lotus Notes. 30 152
Counting documents in a Domino View 3 133
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question