|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Commands Reference > Selection > GetTreeParentChildSelection |
Returns in the %TEMP%\DBWRESLT.IN text file the unique ids of the selected items in the Tree Page, with all their parent unique ids.
In this way a specific item of the tree can be exactly identified depending on his parent item.
call DBWShell("GetTreeParentChildSelection")
The format of the result file is:
@SELECTION_PARENT_CHILD=0,<root uid>
@SELECTION_PARENT_CHILD=<parent uid>,<child uid>
@SELECTION_PARENT_CHILD=<parent uid>,<child uid>
...
Suppose you have the following tree:

Suppose you select all the P1 items; the result file will be:
@SELECTION_PARENT_CHILD=<uid of A1>,<uid of P1>
@SELECTION_PARENT_CHILD=0, <uid of SUB-A1>,<uid of P1>
A VBScript sample of usage is the following:
sub main
DBWInit(TRUE)
DBWShell("GetTreeParentChildSelection")
parentChildString = ""
Set fs = CreateObject("Scripting.FileSystemObject")
Set tfolder = fs.GetSpecialFolder(TemporaryFolder)
Set a = fs.OpenTextFile( tfolder & "\" & "dbwreslt.in", ForReading, True )
Dim tokens
Do While a.AtEndOfStream <> True
line = a.ReadLine
tokens = Split( line, "=", 2, 1)
parentChildString = parentChildString + tokens(1) + vbcrlf
Loop
a.Close
DBWMsgBox "ParentChild Selection:" & vbcrlf & parentChildString
end sub