Description
You can register a document once and then link the document to all records in Isah the document is related to, such as customers, suppliers and parts (over 60 different Isah items). For example, you could link the same assembly instructions to several parts. The links are defined in theT_DocumentDetail table.
Managing Document Links
Document Links are based on the IISPDMDocumentLinks interface. The document object contains a DocumentLinks object that includes methods for adding and deleting document links.
Use the Refresh method to read all links into the DocumentLinks object. The object contains a list of all Isah items the document is linked to.
The following example shows how to add a link to part 0. At last, it shows the number of document links.
Dim oDocument As IPDMLink.Document
Set oDocument = New IPDMLink.Document
oDocument.DocId = 224538
Try
oDocument.Refresh()
oDocument.AddDocumentLink 12, "0"
MsgBox "Number of links: " & oDocument.DocumentLinks.Count
Catch ex As Exception
MsgBox "Document 224538 is not present."
End Try
The following example shows how to delete the last document link and subsequently shows the list of remaining links.
Dim oDocument As IPDMLink.Document
oDocument = New IPDMLink.Document
oDocument.DocId = 224538
Try
oDocument.Refresh()
oDocument.DocumentLinks.Delete(oDocument.DocumentLinks.Count -1)
MsgBox "Number of links: " & oDocument.DocumentLinks.Count
End If
Catch ex As Exception
MsgBox("Document error: " & ex.Message)
End Try
Selecting Document Links
The SelectDocument method is available especially for the "Draw part" functionality in standard CAD links. With this method, you can select a document that is linked to an Isah item: documents of a part (TableId = 12), part revision (TableId = 14) or engineering item (TableId = 924). In the Parts form and the Engineering items form the Documents pane will be displayed in which the user can select a document.
If an item should be selected when opening the form, you have to enter the PrimKey of the item. The DocId of the selected document will be returned via an output parameter. If a document is selected when a user closes the form by clicking OK, the result of the SelectDocument method is TRUE, otherwise FALSE.
Code example
Dim lDocId As Long
If oPDMLink.Utility.SelectDocument(12, "0", lDocId) Then
MsgBox "The selected document is: " & lDocId
End If