DBWWhereUsed

<< Click to Display Table of Contents >>

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

DBWWhereUsed

Description

Returns the documents where the current one is used.

Syntax

Function DBWWhereUsed(DocUID, WhereUsedType, ByRef LastDocUIDByRef NumOfDocByRef DocUidArray)

Parameters

DocUid

It is the unique id of the document of which find users.

WhereUsedType

It is a filter to select only some type of document between the users.
The string must be as follows:

for every type of doc:<commas><commas>
example: ""

for a single type of doc: <commas><apostrophe>+ type to find+<apostrophe><commas>
example: "'A'" this shows only assemblies

for multiple type of doc:
<commas>
<apostrophe>+ 1st type to find+<apostrophe><comma>
<apostrophe>+ 2nd type to find+<apostrophe><comma>

...

<commas>
example: "'A','P'" this shows both assemblies and parts

Return values

The function assumes the value of the last document found ID.

LastDocUid

last document found Uinque ID.

NumOfDoc

number of found documents.

DocUidIdArray

array containing the Unique ids of found documents.

See also

DBWSelectFromWhereUsed

Example

Sub main()
 DBWInit(TRUE)
 Dim DocUIdArray()
 Dim num_of_doc
 Dim LastDocUid
 DocUid = 473
 WhereUsedType = "'0','P'" 'shows only projects and drawings
 LastDocID = DBWWhereUsed(DocUid,WhereUsedType,LastDocUid,num_of_doc,DocUIdArray)
 msgbox "Found " & num_of_doc & " documents that use the current one." & _
  vbcrlf & "last one has id: " & LastDocID
 if num_of_doc>1 then
  for i=1 to ubound(DocUIdArray)
   msgbox "Found : " & DocUIdArray(i)
  next
 end if
End Sub