Chapter Contents

Previous

Next
Organizational Chart: _repopulate

Organizational Chart: _repopulate



Builds or rebuilds all or part of an organizational chart from the specified SAS data set or SCL list


Syntax
Examples
Example 1: Populating a chart from a data set identifier
Example 2: Creating a leaf node

Syntax

CALL NOTIFY (orgchart-name, '_repopulate'<, id-type<, data-id<, maplist<, node-id<, append<, collapse>>>>>>);

Argument Type Description
id-type
N specifies a value indicating the type of data in data-id:


0 a standard SCL list where each item name and value are shown as a node


1 an SCL list whose items are valid node variables


2 a SAS data set


If id-type is missing or omitted, the method uses the data type specified in the Attributes window.
data-id
N specifies the identifier of the SCL list or SAS data set with which to populate the chart. If data-id is an empty list or a 0, all nodes in the tree are deleted. If data-id is missing or omitted, the method uses the value specified in the Attributes window and stored in the DATASET or DATALIST instance variable.
maplist
N specifies the identifier of an SCL list that maps node variables to data set variables. If maplist is missing or omitted, the method uses the mapping list defined in the Mapping List window and stored in the MAPLIST instance variable. Maplist is ignored if the chart is populated with an SLIST entry.
node-id
N specifies the numeric identifier of the node to repopulate. By default, the entire tree is cleared and replaced with the new data. If node-id is not 0 and not missing, the new data replaces the existing children of the node. To add a new tree to the existing children of the node, use the append argument. If node-id is omitted or missing, the entire tree is repopulated.
append
N adds the new nodes as children of node-id if the value specified is anything other than 0. If append is omitted, missing, or 0, all existing children of node-id are deleted before the new nodes are added. If append is greater than 0, the nodes are inserted as children beginning at the position ABS(append).
collapse
N specifies whether to display or hide the node's children


0 displays all children (the default)


1 hides all children


2 hides all grandchildren.


Ignored if node-id is not used.

Note:   Any missing numeric value in the table or SCL used to get the data for the organizational chart will be converted to a zero (0) before the _repopulate method runs.  [cautionend]

The _repopulate method is automatically invoked by the _postinit method if not invoked directly by the SCL program.

_repopulate can rebuild the entire tree, rebuild individual branches, or append items to existing branches. In addition it can replace or override data specifications given in the Attributes and Mapping List windows. Omitted arguments default to the specification given in the Attributes window or to the value of the associated instance variables: DATALIST, DATASET, or MAPLIST.

If data-id is a list, use the DELLIST function to remove it after _repopulate is called. If data-id is a data set identifier, use the CLOSE function to close it.

All arguments (except id-type) require at least a missing value for all preceding arguments. For example, to specify only the maplist argument, provide missing values for the preceding arguments:

call notify('org1','_repopulate_', ., .,
             maplist);


Examples

Example 1: Populating a chart from a data set identifier

This example populates the chart ORG1 from the data set identifier in DSID. Because append is nonzero, all the data read in from DSID are simply added to node NODEID without deleting any of its prior children.

ORG1:
   call notify('org1', '_get_selected_',
                widgetid, nodeid);
   if (nodeid eq 0) then return;
   infol = 0;
   call notify('org1', '_get_current_',
                nodeid, "TEXT", infol);
   month = getnitemc(info, "TEXT");
   dsid  = open("MYLIB." || month || 
           "SALES","I");
   call notify('org1', '_repopulate_', 2,
                dsid, ., nodeid, 1);
   rc = close(dsid);
   rc = dellist(infol, "Y");
return;

Example 2: Creating a leaf node

This example makes a node a leaf node by deleting all of its children:

ORG2:
   call notify ('org2', '_get_selected_',
                 widgetid, nodeid);
   if nodeid = 0 then return;
   call notify ('org2', '_repopulate_', 1,
                 0, ., nodeid);
return;


Chapter Contents

Previous

Next

Top of Page

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