Doclink

Hi,

i’ve searched this forum for the past 2 hours with no success. Probably not searching quite the right thing …well here goes :

i have a document opened in edit mode and i want to insert doclinks from another DB into the document. I do not want to close and re-open the document using a richtext. I would like this to be transparent for the user ( no save, no close). Is this possible ??

I have tried to put un doc.universalID value of the linked document in a field to see if the field would show a link instead of the numeric value … no success…

i’m sure the is a way … maybe with @commands ???

Pleas help

Subject: Doclink

Why don’t you want to use the rich text methods and opening and closing the doc? Is there a justified business reason for this?

I have done this in many applications and it is transparent to the end user doing a save / close / open - the screen flickers for a second but the doclinks magically appear.

Subject: RE: Doclink

Hi,

thanks for the repy …

i don’t want to have to save the document… the user may have entered data in a field, then creates the doclink and then decides to discard the changes … so, i dont want to save the document without him having asked for it !!

Thanks

Subject: Doclink (SOLVED)

Hi all,

here is my solution :

i create a new document;

from a button, i get a handle on the docs for which i want to create doclinks (with picklistcollection method) ;

i create a new temporary document (backend) from a form that contains 1 richtext field;

then, i cycle through the documents (from the picklist) and i create the doclinks(with appenddoclink method) in this richtextfield;

when i’m finished populating this field, i save the temp doc and get a handle on it in edit mode (set newuidoc = ws.editdocument(true,tmpdoc));

the, i goto the field and copy it’s content;

close the newuidoc;

i then get back the handle on my current uidoc;

goto my richtext field;

and paste the data;

here is the sample code :

Set uidoc = ws.CurrentDocument

Set doc = ws.CurrentDocument.Document

Set Collection = ws.PickListCollection( 3, True, servername, filename, ViewName, “select”", “select the doclinks” )

Set colldoc = Collection.GetFirstDocument

Set newDoc = New notesdocument(db)

While Not colldoc Is Nothing

    Dim rtitem As NotesrichtextItem

    Set rtitem = New notesrichtextitem(newdoc, "liens")

    Call rtitem.AppendDocLink(colldoc,"test")

    Call rtitem.AddNewline(1)

    Set colldoc = Collection.GetNextDocument(colldoc)

Wend

If collection.Count > 0 Then

    newdoc.form = "links"

    Call newdoc.save(True,True)	

    Set newuidoc =  ws.EditDocument(True,newdoc)

    Call newuidoc.GotoField("liens")

    Call newuidoc.SelectAll

    Call newuidoc.Copy

    Call newuidoc.Close

    Call uidoc.GotoField("my richtext field")

    Call uidoc.Paste

End If

juste create an agent that delete the temp docs !!! Voilà !!

Hope’s this helps someone !!

PLEASE : respond to this thread if this helps as i am quite proud of my solution !!!

Subject: RE: Doclink (SOLVED)

Hi Stephan,

with some tweaking I managed to get your code to work and it is a fine code if you ask me. But!

What if the rich text field on uidoc (as declared in the code) is computed rather than editable?

In that case, Call uidoc.Paste will ultimately fail because Paste method only works in editable fields.

And by the way, Call newuidoc.Copy will also fail, unless the rich text item we are copying from is editable.

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/01d300d3f4919ce385256e760060feae?OpenDocument by Bryce seems to be the best solution for appending doclinks to currently open uidoc. However, for editable fields, your solution will, indeed, work like a charm.

Subject: Doclink

Nope, cant be done. You could save a list of unids, then create the doc links on QueryClose