Chapter Contents

Previous

Next
Organizational Chart: _traverse

Organizational Chart: _traverse



Calls the specified SCL label for every node in the tree or specified subtree


Syntax
Details
Example

Syntax

CALL NOTIFY (orgchart-name, '_traverse', node-id, list-of-names, list-id, label);

Argument Type Description
node-id
N specifies the numeric identifier of the node for which the labeled section of SCL code is being run
list-of-names
C specifies a single, quoted text string containing the names of the node variables whose values are to be returned in list-id. Separate multiple node variable names with a space. Specify 'ALL' to return the value of all variables.


You can control the processing by including one of these options as the last item in the text string:


/C (current) run label only for the subtree beginning at node-id


/R (reverse) process nodes in reverse order of the default


/W (widget) run label only for nodes that are currently displayed
list-id
N specifies the identifier of an SCL list in which the _traverse method stores the variable values for the current node being traversed
label
C specifies the label of the SCL program section to run for each node. _traverse calls _getCurrent before running label.


Details

Each time label runs, the organizational chart object sets node-id to the next node in the sequence. To traverse only a subtree instead of the entire tree, include the /C option in list-of-names and assign node-id on the initial call. The value automatically changes on the first call to label.

_traverse repeats this process for each node:

  1. Calls _getCurrent and optionally creates and always fills list-id for the current node.

  2. Sets node-id.

  3. Calls label.

When done, if _traverse created the list, it deletes it.


Example

This example uses the _traverse method to change the colors of the nodes. After _repopulate executes, all the nodes with a numeric value less than 0 are set to a red background. Otherwise, the background color is green. The organizational chart object calls the SETCOLOR section for each node in the tree after setting N to the node identifier and filling MYLIST with each node's data.

REPOP:
   call send(orgid,'_repopulate_');
   mylist = 0;
   call send(orgid,'_traverse_',n,'nvalue',
             mylist,'setcolor');
return;

   /* the labeled section called by the
      _traverse method */
SETCOLOR:
   value = getnitemn(mylist,'nvalue');
   if (value lt 0) then color = 'red';
   else color = 'green';
   call send(orgid,'_set_color_',
            'background_color',color,.,n);
return;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.