DBWGetLinks

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > Database >

DBWGetLinks

Description

Retrieves unique id of parents/children documents related to the current one.

Syntax

Function DBWGetLinks(uid, byref linkList, linkType, optionalQueryFilter)

Parameters

uid

it is the unique id of the document

linkType

if 0:look for children
if 1:look for parents

optionalQueryFilter

It is an optional filter to apply in the search. It must be in sql standard syntax.

Return Values

The function assumes as value the number of linked documents found.

linkList

It is an array containing the unique ids of the documents found.

Example

Dim drawingList()
n = DBWGetLinks( uid, drawingList, 1, " AND T IN ('D')" )
msgbox "I've found " & n & " documents"

sub main()
 DBWINIT(TRUE)
 DBWShell("CurrentDocument")
 uid = DBWResult("@DOCUMENT_UNIQUE_ID")
dim linklist()
 optionalQueryFilter = ""
 numchildren = DBWGetLinks(uid, linkList, "0", optionalQueryFilter)
 numparents= DBWGetLinks(uid, linkList, "1", optionalQueryFilter)
 dbwmsgbox "children=" & numchildren & vbcrlf & "parents=" & numparents
end sub