Understanding View Trees

These topics are for developers of PeopleSoft applications who want to display a tree from an application page, and enable users to select a node or leaf from the tree. It provides an overview of View Trees and discusses how to invoke View Trees from application pages.

Use a secondary ‘Tree Viewer’ page, (PSTREEVIEWER), to display an existing PeopleSoft tree from an application using the same HTML format as PeopleSoft Tree Manager. It enables the user to select a node or a leaf from a tree and return the selected node or leaf back to the application.

The following PeopleTools definitions are used:

  • Secondary Page: PSTREEVIEWER

  • Work Page: PSTREEVIEWERWRK

  • Work Record: PSTREEVIEWWRK

The work record and work page are used as a way to transfer data between an application page and the secondary page. The PSTREEVIEWWRK record contains fields that define which tree to display, whether the user has selected a node or leaf, and control fields that give the application some control over the display options of the tree.

The following fields identify the specific tree to be displayed. These values should be populated by the calling application as discussed in the following table.

Field

Description

SetID

SetID of the Tree to be displayed. Required if the tree is keyed by a setID.

SetCntrlValue

Business unit or SetCntrlValue of the Tree to be displayed.

Required if the tree is keyed by a business unit or SetCntrlValue.

Tree_Name

Name of the tree to be displayed. Required.

EffDt

Specify either the Tree’s Effective Date, or the date to be used for finding the most current effective-dated version of the tree.

Tree Viewer performs a maximum effective date test and displays the most current tree whose effective date is less than or equal to the EffDt value passed in the PSTREEVIEWWRK record.

Note: If a tree contains branches, they are ignored and shown as regular nodes. However, the root node displays with the branch icon to indicate that the tree does contain branches.

There are two methods of opening the PSTREEVIEWER secondary page from an application:

  • Without ‘MultiNode’ Selection (Method A): Enables user to select, and application to receive a single node with level information, or a leaf with parent node information.

  • With ‘MultiNode’ Selection (Method B): Enables user to select, and application to receive multiple nodes without level information. If user selects a leaf the parent node is returned.

The following fields indicate whether specific nodes or a leaf has been selected by the application. These fields can be populated by the calling application if it wants the position of a specific node or leaf, identifying it as the currently selected. The fields are also updated or populated on the Tree Viewer secondary page (PSTRREVIEWER), when the user selects a specific node or leaf and clicks the Select button.

If the application specifies the node value and the leaf value, the search tries to find the leaf under the specified node. This is important when a tree contains duplicate leaves. If a tree does have duplicate leaves and no node is specified, the first leaf occurrence is returned.

Field Name

Description

Remarks

Tree_Node

The Node_Id selected.

Must be an exact match to the Node_Id stored in the PSTREENODE table.

Input and/or Output

Tree_Level_Num

Level number associated with the selected node.

Output

Tree_Level

Level name associated with the selected node.

Output

Tree_Level_Descr

Level description associated with the selected node.

Output

Leaf_Selected

Y/N flag.

Indicates whether the application specified a leaf.

Input

Range_From

Range from value of the selected leaf.

Input and/or Output

Range_To

Range to value of the selected leaf.

Input and/or Output

Dynamic_Flag

Indicates whether the selected leaf is dynamic.

Output

Message_Set_Nbr

Populated in PSTREEVIEWERWRK if error occurs. For example, selected node or leaf is not found.

Collapsed tree is displayed.

Output

Message_Nbr

Populated in PSTREEVIEWERWRK if error occurs. For example, specifed node or leaf is not found.

Collapsed tree is displayed.

Output

Multinode

Holds list of selected nodes as a comma-separated string.

Populated if Multinodeselection is set to "Y".

Output

The following fields (input) can be used to control the appearance and formatting of the Tree Viewer secondary page:

Field Name

Description

Page_Size

Determines the number of lines to be displayed on a given page.

If no value is specified the default value is 60 lines per page.

Show_Leaves

Y/N flag.

Controls whether the Tree Viewer displays Detail Values.

Show_Levels

Y/N flag.

Controls whether the Tree Viewer should display the Level Description next to the node description.

Multinodeselection

Y/N Flag.

Default = "N"