|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Library Reference > Tree > DBWWalkTree |
Traverses a document tree.
Function DBWWalkTree(DocUID, Parent, OptionalQueryFilter)
DocUID |
It is the unique id of the root document. |
|---|---|
Parent |
<0/1> |
OptionalQueryFilter |
further specification for the tree walking. 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 to search only in certain documents (projects, parts, ...). " AND T='0' " |
The example below is quite explanatory.
You must use a sub called UserProcessDocument to execute actions while traversing the tree; it is run for each node of the tree you traverse.
As you can note, in the sub main there is only a call to DBWWalkTree with parameters, the whole processese are exeuted in the UserProcessDocument sub.
Please note also the DBWStopProcessing statement. It stops the tree traversing.
Related commands and functions
Sub Main
DBWInit(True)
DBWShell("CurrentDocument")
uid = DBWResult("@DOCUMENT_UNIQUE_ID")
DBWWalkTree uid, 0, ""
end sub
'call back for the DBWWalkTree
sub UserProcessDocument( uid )
state = DBWQueryByUid( uid, DBWLookUp("NAME_FIELD_STATE") )
if state = DBWLookUp("NAME_STATE_NEW_STRING") or state = DBWLookUp("NAME_STATE_BEING_MODIFIED") then
id = DBWQueryByUid( uid, DBWLookUp("NAME_FIELD_ID") )
fileName = DBWQueryByUid( uid, DBWLookUp("NAME_FIELD_FILE_NAME") )
fileDir = DBWQueryByUid( uid, DBWLookUp("NAME_FIELD_FILE_DIRECTORY") )
MsgBox "Document ID=" & id & " File=" & fileDir & fileName & " is still in a MODIFIABLE state"
DBWStopProcessing = True
end if
end sub