Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 431
  • Last Modified:

Document link problem....

Hi experts,

I'm able to create a documentlink in a document, to a document in another database using @DbLookup. The documentlink is present on the form, but when i click the link a message appears:

The linked document cannot be found in the view.

What can be wrong ? Is the documentlink incomplete, so it's looking in the local database for the document ?
How can I generate a "complete" documentlink, that jumping to the document in the other database ?

Greetings,

Bob
0
oosterbaan
Asked:
oosterbaan
  • 5
  • 4
1 Solution
 
HemanthaKumarCommented:
The best method would be to use Richtext method AppendDocLink, This creates fully qualified link with server name and replica id of the database.

By the way what is your method of creating doc link. If it is through dblookup, then how ??? Most of the tweaks desn't work properly.

~Hemanth
0
 
oosterbaanAuthor Commented:
Hi Hemanth,

This is the way how I did it...

I've created in every document in the source database a computed when composed textfield, containing the formula @DocumentUniqueID.
In the target database, I'm using the @DbLookup in a computed textfield, the get the documentlink from the source document:

@DbLookup("":"NoCache";"<replicaID sourceDB>";"<ViewName>";"<key to document>";"<Fieldname containing DocuniqueID>").

This is working very well, when the document is in the same database...

Greetings,

Bob
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
oosterbaanAuthor Commented:
I have no knowledge with writing LotusScript, but is there a way to create a button (instead of a doclink) to jump to a other form in another database. I have red something about a LotusScript command called GetDocumentById.
I can imagine that I set the DocumentID in the source document (other database) in a computed when composed field and transfer this value to the target document. After transfering the value (the DocumentID) I can use this with the GetDocumentByID command to open the document...

Greetings,

Bob
0
 
HemanthaKumarCommented:
Try this in a button

dim ws as New NotesUIworkspace
dim doc as NotesDocument
dim db as NotesDatabase

set db = New NotesDatabase( Server, File )
set view = db.GetView( "<viewname>" )
set doc = view.GetDocumentByKey( "<Key to Document>")
If not doc is nothing then
call ws.EditDocument( True, doc )
end if

0
 
oosterbaanAuthor Commented:
Thanks HemanthaKumar,

Thanks for your code....

Can you help me out to modify your code ? I like to change a few things (if it is possible) ?

- The server and filename are in a variable (a field on the document) and is it possible to use a replicaID instead of the server and filename ?

- The "Key to Document" is also present in a field on the document. Is it possible to use this, and how is the syntax in that case ?

- I suppose that the line "call ws.EditDocument(True,doc) will open the document in editmode. I like to have it openend in readmode. The user who will click this button will only have read rights on this database....

Thanks....

Greetings,

Bob

0
 
HemanthaKumarCommented:
This is the modified code, with replicaid and key from uidocument

dim ws as New NotesUIworkspace
dim note as NotesDocument
dim doc as NotesDocument
dim db as New NotesDatabase( "", "" )

set note = ws.CurrentDocument.Document
If db.OpenByReplicaID( note.Server(0), note.ReplicaID(0) ) Then

set view = db.GetView( "<viewname>" )
set doc = view.GetDocumentByKey( note.Key(0) )
If not doc is nothing then
call ws.EditDocument( FALSE, doc ) ' opens in read mode
end if
End IF

0
 
oosterbaanAuthor Commented:
Thanks Heman~

When using your last code, I get a error saying:

"Invalid replica id (<ReplicaID that's in the field>)"

It's a computed by composed field and set OK, because I'm using this field also for a @DbLookup in this database.

If you have not any idea what this can be, please change your code using the database filename in a variable instead of a ReplicaID. I can use this also....

Greetings,

Bob
0
 
HemanthaKumarCommented:
I hope the format of replicaid is wrong it should not be like
"85255FA9:00747B84", instead it should be like this "85255FA900747B84".

Convert the value into text type by either using @text in the default value of the replica id field

or


Use this

dim ws as New NotesUIworkspace
dim doc as NotesDocument
dim db as NotesDatabase

set db = New NotesDatabase( note.Server(0), note.File(0) )
set view = db.GetView( "<viewname>" )
set doc = view.GetDocumentByKey( note.Key(0) )
If not doc is nothing then
call ws.EditDocument( FALSE, doc ) ' opens in read mode
end if

~Hemanth
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now