Creating database links based on field

Is there a way I can create links in a form in one database to forms in another database that have the same value in a certain field (like a part number)? Basically, I want to be able to directly link to supporting forms in a database through a main form that resides in a separate database. I attempted to do this with an embedded view, but I don’t think I have a deep enough understanding of database to database communication to accomplish this. Any help would be greatly appreciated!

Subject: Creating database links based on field

Yes it is possible to link documents from various databases based on a ‘unique’ value in a given field, like part number.

here’s a snipnet:

If doc.PartNumber(0) ="" Then 

Else

	Set db = session.Getdatabase("servername","dnname.nsf") 

	Set view = db.GetView ("($links)") 'a view that contains the referencing documents sorted and categorized by partnumber

	Forall c In view.Columns 

		If ( c.IsSorted And c.IsCategory ) Then 

			Set column = c 

			Exit Forall 

		End If 

	End Forall 

	Set linkdoc = view.GetDocumentByKey( doc.PartNumber(0) ) 	

	

	If Not linkdoc Is Nothing Then 

		

		Dim rtitem As NotesRichTextItem

		Set rtitem = New NotesRichTextItem( doc, "Link_Field" )

		Call rtitem.AppendDocLink (linkdoc, db.title)

	End If 

End If

basically, you need a richtext field in your document to hold the link of the referencing docs, i used a field called Link_Field.

ST

Subject: RE: Creating database links based on field

Thanks for the reply, I’ll give that a shot. I don’t suppose there’s a way I could do this with an embedded view as well, using the part number as the selection criteria so that only documents related to a certain part number are shown, could I?

Subject: RE: Creating database links based on field

Yea you could, u have to use a categorized embedded view where the category is = part number; on the embedded view enter PartNumber under the Show Single Category property.

This is a much simpler solution then creating the doclinks.

ST

Subject: RE: Creating database links based on field

Thanks alot for the help, the embedded view worked great!