DBWGetParents

<< Click to Display Table of Contents >>

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

DBWGetParents

Description

Retrieves a list of current document parents.

Syntax

Function DBWGetParents(uid, ByRef ParentList, optionalQueryFilter)

Parameters

uid

the unique id of the root document

optionalQueryFilter

a further specification for the search.

This it's a part of a query, so you've to set it in this way:

" AND <condition> "

For example you can specify that you want only certain documents (projects, parts, ...).
You have to set the variable as

" AND T='0' "

Return Values

The function assumes the value of the number of records found.
If no record has been found the function assumes a zero value.

ParentList

array containing the unique ids of parent documents.

See also

Function DBWGetChildren

Example

Sub main()
 dim arr_parents_uid()
 DBWInit(TRUE)
 'retrieve the currently selected document uid
 call DBWShell( "CurrentDocument" )
 if (okDBW = False) then exit sub
 docUId = DBWResult( "@DOCUMENT_UNIQUE_ID" )
 num_of_parents = DBWGetParents(docUId, arr_parents_uid, "")
 msgbox num_of_parents & " parents found"
 str = "Parent UID list:" & vbcrlf
 for i=0 to num_of_parents-1
  str = str & arr_parents_uid(i) & vbcrlf
 next
 msgbox str
end sub