Home » Developer & Programmer » Forms » plzzzzzzzzzzz hel me Hierarchical Tree form 6i
plzzzzzzzzzzz hel me Hierarchical Tree form 6i [message #87307] |
Fri, 17 December 2004 00:41 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
shish mate
Messages: 49 Registered: February 2004
|
Member |
|
|
hi
i'm trying to learn Hierarchical Tree
i've created Hierarchical Tree item. based on record group.
in diz. time if i press the button to attach
record group to my Hierarchical Tree. it gives me error
frm-40105 unable to resolve refe. item.
what is this
i'm fade up of this pl. help me
if posiibal send me code of Hierarchical Tree list @
ashishnmate@yahoo.com
plzzzzzzzzzzz hel me
ashish
|
|
|
Re: plzzzzzzzzzzz hel me Hierarchical Tree form 6i [message #87327 is a reply to message #87307] |
Sat, 18 December 2004 08:53 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Just John
Messages: 69 Registered: November 2004
|
Member |
|
|
start here....
Hierarchical Tree Widget Contents
About Hierarchical Trees - Overview
Adding Data to a Hierarchical Tree
Creating a Hierarchical Tree
Format of Data Used to Populate a Hierarchical Tree
Manipulating a Hierarchical Tree at Runtime
Populating a Hierarchical Tree
Setting Hierarchical Tree Item Properties
Specifying an Initial Value for a Hierarchical Tree
When-Tree-Node-Activated Trigger
When-Tree-Node-Expanded Trigger
When-Tree-Node-Expanded Trigger
ADD_TREE_DATA Built-In
ADD_TREE_NODE Built-In
DELETE_TREE_NODE Built-In
FIND_TREE_NODE Built-In
GET_TREE_NODE_PARENT Built-In
GET_TREE_NODE_PROPERTY Built-In
GET_TREE_PROPERTY Built-In
GET_TREE_SELECTION Built-In
POPULATE_GROUP_FROM_TREE Built-In
POPULATE_TREE Built-In
SET_TREE_SELECTION Built-In
SET_TREE_NODE_PROPERTY Built-In
SET_TREE_PROPERTY Built-In
About Hierarchical Trees - Overview
The hierarchical tree displays data in the form of a standard navigator, similar to those used in Oracle Developer.
You can populate a hierarchical tree with values contained in a Record Group or Query Text. At runtime, you can programmatically add, remove, modify, or evaluate elements in a hierarchical tree.
The amount of data displayed at any one time depends upon the expansion of individual data nodes, whether through built-ins or a user clicking on a node. The data set generally will be initially specified in Form Builder, and may be modified or entirely replaced at runtime.
Return to Contents
Adding Data to Hierarchical Trees
You can add data to a tree view by:
Populating a tree with values contained in a record group or query by using the Populate_Tree built-in.
Adding data to a tree under a specific node by using the Add_Tree_Data built-in.
Modifying elements in a tree at runtime by using built-in subprograms.
Adding or deleting nodes and the data elements under the nodes.
Note: All built-ins are located in the FTREE built-in package.
-- Hierarchical Tree Example
--
-- The first action will typically be to populate the
-- hierarchical tree (htree) with data.
DECLARE
htree ITEM;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Sets the record group and causes the data to display.
Ftree.Set_Tree_Property(htree,
Ftree.RECORD_GROUP,
'record_group5');
END;
-- Tree Node Expansion Example
--
-- This code will expand all nodes in a tree.
DECLARE
htree ITEM;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the root node of the tree.
node := Ftree.Find_Tree_Node(htree, '');
-- Loop through all nodes and expand each one if it is collapsed.
WHILE NOT Ftree.ID_NULL(node) LOOP
state := Ftree.Get_Tree_Node_Property(htree,
node,
Ftree.NODE_STATE);
IF state = Ftree.COLLAPSED_NODE THEN
Ftree.Set_Tree_Node_Property(htree,
node,
Ftree.NODE_STATE,
Ftree.EXPANDED_NODE);
END IF;
node := Ftree.Find_Tree_Node(htree, '', search_root => node);
END LOOP;
END;
-- Delete Tree Node Example
--
-- This code will delete all tree nodes marked as selected. See the
-- Ftree.Set_Tree_Selection built-in for a definition of "selected".
DECLARE
htree ITEM;
num_selected NUMBER;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the number of nodes marked as selected.
num_selected := Ftree.Get_Tree_Property(htree, Ftree.SELECTION_COUNT);
-- Loop through nodes and delete them. Since nodes are internally
-- re-numbered when one is deleted, be sure to loop in reverse
-- order from last to first.
FOR j IN num_selected..1 LOOP
Ftree.Delete_Tree_Node(htree, Ftree.Get_Tree_Selection(htree, j));
END LOOP;
END;
Return to Contents
Creating a Hierarchical Tree
To create a hierarchical tree:
In the Object Navigator, click the plus icon beside the desired block node. Form Builder expands the block node and displays its subnodes.
Click the Items node.
Click the Create button in the toolbar. A new item with a default name is inserted under the Items node.
Double-click the object icon beside the new item to display the Property Palette.
Under the General node, set the Item Type property to Hierarchical Tree.
Under the Physical node, set the Canvas property to the name of the desired canvas. Note: To display an item at runtime, you must assign it to a canvas.
Return to Contents
Format of Data Used to Populate a Hierarchical tree
The columns in the record groups or queries used to populate a hierarchical tree are:
Initial state
Node tree depth
Label for the node
Icon for the node
Data
For example, the data in the table below would produce the following hierarchical tree:
Initial State
Depth
Label
Icon
Data
-1
1
'Car'
null
'car'
0
2
'Honda'
null
'civic'
1
1
'Airplane'
null
'plane'
0
2
'Boeing'
null
'747'
0
2
'Boeing'
null
'757'
Return to Contents
Manipulating a Hierarchical Tree at Runtime
Form Builder provides triggers that you can use to respond to events that occur when the end user interacts with the hierarchical tree at runtime.
When-Tree-Node-Activated
When-Tree-Node-Expanded
When-Tree-Node-Selected
At runtime, you can programmatically add, remove, modify, or evaluate elements in a hierarchical tree by using the following built-in subprograms:
Add_Tree_Data
Add_Tree_Node
Delete_Tree_Node
Find_Tree_Node
Get_Tree_Node_Parent
Get_Tree_Selection
Populate_Group_From_Tree
Populate_Tree
Set_Tree_Selection
Note: All built-ins are located in the FTREE built-in package.
Return to Contents
Populating a Hierarchical Tree
You can populate a hierarchical tree with values contained in a Record Group or Query Text by using the following built-in subprogram:
Populate_Tree
Add_Tree_Data
Note: All built-ins are located in the FTREE built-in package.
Return to Contents
Setting Hierarchical Tree Item Properties
To set a hierarchical tree item property in Form Builder:
In the Object Navigator, double-click the object icon beside the desired hierarchical tree.
In the Property Palette, select the property you want to set.
Set the selected property to the desired setting.
You can set properties during runtime by using the following built-ins:
Get_Tree_Node_Property
Get_Tree_Property
Set_Tree_Node_Property
Set_Tree _Property
Note: All built-ins are located in the FTREE built-in package.
Return to Contents
Specifying an Initial Value for a Hierarchical Tree
To specify an initial value for a hierarchical tree:
In the Object Navigator, double-click the object icon beside the desired hierarchical tree object to display the Property Palette.
Under the Functional node, indicate the Record Group or Query Text that contains the initial values.
Note: These are indicators of the initial values, but nothing appears without populating the tree with the Populate_Tree built-in.
Return to Contents
When-Tree-Node-Activated Trigger
Description Fires when an operator double-clicks a node or presses Enter when a node is selected.
Definition Level form or block
Legal Commands SELECT statements, unrestricted built-ins, restricted built-ins
Enter Query Mode yes
Usage Notes SYSTEM.TRIGGER_NODE is the node the user clicked on. SYSTEM.TRIGGER_NODE returns a value of type NODE.
No programmatic action will cause the When-Tree-Node-Activated trigger to fire. Only end-user action will generate an event.
On Failure no effect
Return to Contents
When-Tree-Node-Expanded Trigger
Description Fires when a node is expanded or collapsed.
Definition Level form or block
Legal Commands SELECT statements, unrestricted built-ins, restricted built-ins
Enter Query Mode yes
Usage Notes SYSTEM.TRIGGER_NODE is the node the user clicked on. SYSTEM.TRIGGER_NODE returns a value of type NODE.
No programmatic action will cause the When-Tree-Node-Expanded trigger to fire. Only end-user action will generate an event.
On Failure no effect
Return to Contents
When-Tree-Node-Selected Trigger
Description Fires when a node is selected or deselected.
Definition Level form or block
Legal Commands SELECT statements, unrestricted built-ins, restricted built-ins
Enter Query Mode yes
Usage Notes SYSTEM.TRIGGER_NODE is the node the user clicked on. SYSTEM.TRIGGER_NODE returns a value of type NODE.
No programmatic action will cause the When-Tree-Node-Selected trigger to fire. Only end-user action will generate an event.
On Failure no effect
Return to Contents
ADD_TREE_DATA Built-In
Description Adds a data set under the specified node of a hierarchical tree item.
Syntax PROCEDURE ADD_TREE_DATA
(item_id ITEM,
node NODE,
offset_type NUMBER,
offset NUMBER,
data_source NUMBER,
data VARCHAR2);
PROCEDURE ADD_TREE_DATA
(item_name VARCHAR2,
node NODE,
offset_type NUMBER,
offset NUMBER,
data_source NUMBER,
data VARCHAR2);
PROCEDURE ADD_TREE_DATA
(item_name VARCHAR2,
node NODE,
offset_type NUMBER,
offset NUMBER,
data_source NUMBER,
data RECORDGROUP);
PROCEDURE ADD_TREE_DATA
(item_id ITEM,
node NODE,
offset_type NUMBER,
offset NUMBER,
data_source NUMBER,
data RECORDGROUP);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
offset_type Specifies the type of offset for the node. Possible values are:
PARENT_OFFSET
SIBLING_OFFSET
If offset_type is PARENT_OFFSET, adds a data subset immediately under the specified node at the location among its children indicated by offset.
If offset_type is SIBLING_OFFSET, adds the new data as a sibling to the specified node.
offset Indicates the position of the new node.
If offset_type is PARENT_OFFSET, then offset can be either 1-n or LAST_CHILD.
If offset_type is SIBLING_OFFSET, then offset can be either NEXT_NODE or PREVIOUS_NODE.
data_source Indicates the type of data source. Possible values are:
RECORD_GROUP
QUERY_TEXT
data Specifies the data to be added. If data source is QUERY_TEXT, then data is the text of the query. If data source is RECORD_GROUP, then data is an item of type RECORDGROUP or the name of a record group.
Example -- This code copies a set of values from a record group
-- and adds them as a top level node with any children
-- nodes specified by the structure of the record group.
-- The new top level node will be inserted as the last
-- top level node.
DECLARE
htree ITEM;
rg_data RECORDGROUP;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the record group.
rg_data := FIND_GROUP('new_data_rg');
-- Add the new node at the top level and children.
Ftree.Add_Tree_Data(htree,
Ftree.ROOT_NODE,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.RECORD_GROUP,
rg_data);
END;
Return to Contents
ADD_TREE_NODE Built-In
Description Adds a data element to a hierarchical tree item.
Syntax FUNCTION ADD_TREE_NODE
(item_name VARCHAR2,
node NODE,
offset_type NUMBER,
offset NUMBER,
state NUMBER,
label VARCHAR2,
icon VARCHAR2,
value VARCHAR2);
FUNCTION ADD_TREE_NODE
(item_id ITEM,
node NODE,
offset_type NUMBER,
offset NUMBER,
state NUMBER,
label VARCHAR2,
icon VARCHAR2,
value VARCHAR2);
Built-in Type unrestricted procedure
Returns NODE
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
offset_type Specifies the type of offset for the node. Possible values are:
PARENT_OFFSET
SIBLING_OFFSET
If offset_type is PARENT_OFFSET, adds a data subset immediately under the specified node at the location among its children indicated by offset.If offset_type is SIBLING_OFFSET, adds the new data as a sibling to the specified node.
offset Indicates the position of the new node.
If offset_type is PARENT_OFFSET, then offset can be either 1-n or LAST_CHILD.
If offset_type is SIBLING_OFFSET, then offset can be either NEXT_NODE or PREVIOUS_NODE.
state Specifies the state of the node. Possible vaues are:
COLLAPSED_NODE
EXPANDED_NODE
LEAF_NODE
label The displayed text for the node.
icon The filename for the node?s icon.
value Specifies the VARCHAR2 value of the node.
Example -- This code copies a value from a Form item and
-- adds it to the tree as a top level node. The
-- value is set to be the same as the label.
DECLARE
htree ITEM;
top_node NODE;
new_node NODE;
item_value VARCHAR2(30);
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Copy the item value to a local variable.
item_value := :wizard_block.new_node_data;
-- Add an expanded top level node to the tree
-- with no icon.
new_node := Ftree.Add_Tree_Node(htree,
Ftree.ROOT_NODE,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
item_value,
NULL,
item_value);
END;
Return to Contents
DELETE_TREE_NODE Built-In
Description Removes the data element from the tree.
Syntax PROCEDURE DELETE_TREE_NODE
(item_name VARCHAR2,
node NODE);
PROCEDURE DELETE_TREE_NODE
(item_id ITEM,
node NODE);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
Example -- This code finds a node with the label "Zetie"
-- and deletes it and all of its children.
DECLARE
htree ITEM;
delete_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the node with a label of "Zetie".
-- Start searching from the root of the tree.
delete_node := Ftree.Find_Tree_Node(htree,
'Zetie',
Ftree.FIND_NEXT,
Ftree.NODE_LABEL,
Ftree.ROOT_NODE,
Ftree.ROOT_NODE);
-- Delete the node and all of its children.
IF NOT Ftree.ID_NULL(delete_node) then
Ftree.Delete_Tree_Node(htree, delete_node);
END IF;
END;
Return to Contents
FIND_TREE_NODE Built-In
Description Finds the next node in the tree whose label or value matches the search string.
Syntax FUNCTION FIND_TREE_NODE
(item_name VARCHAR2,
search_string VARCHAR2,
search_type NUMBER,
search_by NUMBER,
search_root NODE,
start_point NODE);
FUNCTION FIND_TREE_NODE
(item_id ITEM,
search_string VARCHAR2,
search_type NUMBER,
search_by NUMBER,
search_root NODE,
start_point NODE);
Built-in Type unrestricted procedure
Returns NODE
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
search_string Specifies a valid node.
search_type Specifies the NUMBER search type. Possible values are:
FIND_NEXT
FIND_NEXT_CHILD Searches just the children of the search_root node.
search_by Specifies the NUMBER to search by. Possible values are:
NODE_LABEL
NODE_VALUE
search_root Specifies the root of the search tree.
start_point Specifies the starting point in the NODE search.
Example -- This code finds a node with a label of "Doran"
-- within the subtree beginning with the a node
-- with a label of "Zetie".
DECLARE
htree ITEM;
find_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the node with a label "Zetie".
find_node := Ftree.Find_Tree_Node(htree, 'Zetie', Ftree.FIND_NEXT,
Ftree.NODE_LABEL, Ftree.ROOT_NODE, Ftree.ROOT_NODE);
-- Find the node with a label "Doran"
-- starting at the first occurance of "Zetie".
find_node := Ftree.Find_Tree_Node(htree, 'Doran', Ftree.FIND_NEXT,
Ftree.NODE_LABEL, find_node, find_node);
IF NOT Ftree.ID_NULL(find_node) then
...
END IF;
END;
Return to Contents
GET_TREE_NODE_PARENT Built-In
Description Returns the parent of the specified node.
Syntax FUNCTION GET_TREE_NODE_PARENT
(item_name VARCHAR2
node NODE);
FUNCTION GET_TREE_NODE_PARENT
(item_id ITEM
node NODE);
Built-in Type unrestricted procedure
Returns NODE
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
Example -- This code could be used in a WHEN-TREE-NODE-SELECTED
-- trigger to locate the parent of the node that was
-- clicked on.
DECLARE
htree ITEM;
parent_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Get the parent of the node clicked on.
parent_node := Ftree.Get_Tree_Node_Parent(htree, :SYSTEM.TRIGGER_NODE);
...
END;
Return to Contents
GET_TREE_NODE_PROPERTY Built-In
Description Returns the value of the specified property of the hierarchical tree node.
Syntax FUNCTION GET_TREE_NODE_PROPERTY
(item_name VARCHAR2,
node NODE,
property NUMBER);
FUNCTION GET_TREE_NODE_PROPERTY
(item_id ITEM,
node NODE,
property NUMBER);
Built-in Type unrestricted procedure
Returns VARCHAR2
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
property Specify one of the following properties:
NODE_STATE Returns the state of the hierarchical tree node. This is either EXPANDED_NODE, COLLAPSED_NODE, or LEAF_NODE.
NODE_DEPTH Returns the nesting level of the hierarchical tree node.
NODE_LABEL Returns the label
NODE_ICON Returns the icon name
NODE_VALUE Returns the value of the hierarchical tree node.
Example -- This code could be used in a WHEN-TREE-NODE-SELECTED
-- trigger to return the value of the node that was
-- clicked on.
DECLARE
htree ITEM;
node_value VARCHAR2(100);
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the value of the node clicked on.
node_value := Ftree.Get_Tree_Node_Property(htree, :SYSTEM.TRIGGER_NODE, Ftree.NODE_VALUE);
...
END;
Return to Contents
GET_TREE_SELECTION Built-In
Description Returns the data node indicated by selection. Selection is an index into the list of selected nodes.
Syntax FUNCTION GET_TREE_SELECTION
(item_name VARCHAR2,
selection NUMBER);
FUNCTION GET_TREE_SELECTION
(item_id ITEM,
selection NUMBER);
Built-in Type unrestricted procedure
Returns NODE
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
selection Specifies the selection of a single node.
Example -- This code will process all tree nodes marked as selected. See the
-- Ftree.Set_Tree_Selection built-in for a definition of "selected".
DECLARE
htree ITEM;
num_selected NUMBER;
current_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the number of nodes marked as selected.
num_selected := Ftree.Get_Tree_Property(htree, Ftree.SELECTION_COUNT);
-- Loop through selected nodes and process them. If you are deleting
-- nodes, be sure to loop in reverse!
FOR j IN 1..num_selected LOOP
current_node := Ftree.Get_Tree_Selection(htree, j);
...
END LOOP;
END;
Return to Contents
GET_TREE_PROPERTY Built-In
Description Returns property values of the specified hierarchical tree.
Syntax FUNCTION GET_TREE_PROPERTY
(item_name VARCHAR2,
property NUMBER);
FUNCTION GET_TREE_PROPERTY
(item_id ITEM,
property NUMBER);
Built-in Type unrestricted procedure
Returns VARCHAR2
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
property Specify one of the following properties:
DATASOURCE Returns the source used to initially populate the hierarchical tree, either in Form Builder or by using the SET_TREE_PROPERTY built-in. Returns EXTERNAL if neither property was set in Form Builder.
RECORD_GROUP Returns the RecordGroup used to initially populate the hierarchical tree, either in Form Builder or by using the SET_TREE_PROPERTY built-in.. This may be a null string.
QUERY_TEXT Returns the text of the query used to initially populate the hierarchical tree, either in Form Builder or by using the SET_TREE_PROPERTY built-in.. This may be a null string.
NODE_COUNT Returns the number of rows in the hierarchical tree data set.
SELECTION_COUNT Returns the number of selected rows in the hierarchical tree.
ALLOW_EMPTY_BRANCHES Returns the character string TRUE or FALSE.
ALLOW_MULTI-SELECT Returns the character string TRUE or FALSE.
Usage Notes The values returned by datasource RECORD_GROUP and QUERY_TEXT do not necessarily reflect the current data or state of the tree.
Example -- This code could be used to find out how many nodes are
-- in a given tree.
DECLARE
htree ITEM;
node_count NUMBER;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Get the node count of the tree.
node_count := Ftree.Get_Tree_Property(htree, Ftree.NODE_COUNT);
...
END;
Return to Contents
POPULATE_GROUP_FROM_TREE Built-In
Description Populates a record group with the data from the hierarchical tree.
Syntax PROCEDURE POPULATE_GROUP_FROM_TREE
(group_name VARCHAR2,
item_name VARCHAR2,
node NODE);
PROCEDURE POPULATE_GROUP_FROM_TREE
(group_name VARCHAR2,
item_id ITEM,
node NODE);
PROCEDURE POPULATE_GROUP_FROM_TREE
(group_id RECORDGROUP,
item_name VARCHAR2,
node NODE);
PROCEDURE POPULATE_GROUP_FROM_TREE
(group_id RECORDGROUP,
item_id ITEM,
node NODE);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters group_name Specifies the name of the group.
group_id Specifies the ID assigned to the group.
item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
Item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node. If specified, indicates a sub-tree used to populate the RecordGroup, including the specified node.
Usage Notes The record group is cleared prior to inserting the hierarchical tree?s data set.
Example -- This code will transfer all the data from a hierarchical tree
-- that is parented by the node with a label of "Zetie" to a
-- pre-created record group. Please see the documentation
-- for the structure of the required record group.
DECLARE
htree ITEM;
find_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Find the node with a label "Zetie".
find_node := Ftree.Find_Tree_Node(htree, 'Zetie', Ftree.FIND_NEXT,
Ftree.NODE_LABEL, Ftree.ROOT_NODE, Ftree.ROOT_NODE);
-- Populate the record group with the tree data.
-- The record group must already exist.
Ftree.Populate_Group_From_Tree('tree_data_rg', htree, find_node);
END;
Return to Contents
POPULATE_TREE Built-In
Description Clears out any data already in the hierarchical tree, and obtains the data set specified by the RecordGroup or QueryText properties.
Syntax PROCEDURE POPULATE_TREE
(item_name VARCHAR2);
PROCEDURE POPULATE_TREE
(item_id ITEM);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
Example -- This code will cause a tree to be re-populated using
-- either the record group or query already specified
-- for the hierarchical tree.
DECLARE
htree ITEM;
top_node NODE;
find_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Populate the tree with data.
Ftree.Populate_Tree(htree);
END;
Return to Contents
SET_TREE_SELECTION Built-In
Description Specifies the selection of a single node.
Syntax PROCEDURE SET_TREE_SELECTION
(item_name VARCHAR2,
node NODE,
selection_type NUMBER);
PROCEDURE SET_TREE_SELECTION
(item_id ITEM,
node NODE,
selection_type NUMBER);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
selection_type Specifies the type of selection.
SELECT_ON Selects the node.
SELECT_OFF Deselects the node.
SELECT_TOGGLE Toggles the selection state of the node.
Example -- This code could be used in a WHEN-TREE-NODE-EXPANDED
-- trigger and will mark the clicked node as selected.
DECLARE
htree ITEM;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Mark the clicked node as selected.
Ftree.Set_Tree_Selection(htree, :SYSTEM.TRIGGER_NODE, Ftree.SELECT_ON);
END;
Return to Contents
SET_TREE_NODE_PROPERTY Built-In
Description Sets the state of a branch node.
Syntax PROCEDURE SET_TREE_NODE_PROPERTY
(item_name VARCHAR2,
node NODE,
property NUMBER,
value NUMBER);
PROCEDURE SET_TREE_NODE_PROPERTY
(item_name VARCHAR2,
node NODE,
property NUMBER,
value VARCHAR2);
PROCEDURE SET_TREE_NODE_PROPERTY
(item_id ITEM,
node NODE,
property NUMBER,
value NUMBER);
PROCEDURE SET_TREE_NODE_PROPERTY
(item_id ITEM,
node NODE,
property NUMBER,
value VARCHAR2);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
node Specifies a valid node.
property Specify one of the following properties:
NODE_STATE Possible values are EXPANDED_NODE, COLLAPSED_NODE, and LEAF_NODE.
NODE_LABEL Sets the label of the node.
NODE_ICON Sets the icon of the node.
NODE_VALUE Sets the value of the node.
value The actual value you intend to pass.
Example -- This code could be used in a WHEN-TREE-NODE-SELECTED
-- trigger to change the icon of the node clicked on.
DECLARE
htree ITEM;
current_node NODE;
find_node NODE;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Change it icon of the clicked node.
-- The icon file will be located using the
-- TK_ICON environment variable in client/server
-- or in the virtual directory for web deployment.
Ftree.Set_Tree_Node_Property(htree,
:SYSTEM.TRIGGER_NODE,
Ftree.NODE_ICON,
'Open');
END;
Return to Contents
SET_TREE_PROPERTY Built-In
Description Sets the value of the indicated hierarchical tree property.
Syntax PROCEDURE SET_TREE_PROPERTY
(item_name VARCHAR2,
property NUMBER,
value NUMBER);
PROCEDURE SET_TREE_PROPERTY
(item_name VARCHAR2,
property NUMBER,
value VARCHAR2);
PROCEDURE SET_TREE_PROPERTY
(item_name VARCHAR2,
property NUMBER,
value RECORDGROUP);
PROCEDURE SET_TREE_PROPERTY
(item_id ITEM,
property NUMBER,
value NUMBER);
PROCEDURE SET_TREE_PROPERTY
(item_id ITEM,
property NUMBER,
value VARCHAR2);
PROCEDURE SET_TREE_PROPERTY
(item_id ITEM,
property NUMBER,
value RECORDGROUP);
Built-in Type unrestricted procedure
Enter Query Mode no
Parameters item_name Specifies the name of the object created at design time. The data type of the name is VARCHAR2 string.
item_id Specifies the unique ID that Form Builder assigns to the item when created. Use the FIND_ITEM built-in to return the ID to an appropriately typed variable. The data type of the ID is ITEM.
property Specify one of the following properties:
RECORD_GROUP Replaces the data set of the hierarchical tree with a record group and causes it to display.
QUERY_TEXT Replaces the data set of the hierarchical tree with an SQL query and causes it to display.
ALLOW_EMPTY_BRANCHES Possible values are PROPERTY_TRUE and PROPERTY_FALSE.
value Specify the value appropriate to the property you are setting:
PROPERTY_TRUE The property is to be set to the TRUE state.
PROPERTY_FALSE The property is to be set to the FALSE state.
Example -- This code could be used in a WHEN-NEW-FORM-INSTANCE
-- trigger to initially populate the hierarchical tree
-- with data.
DECLARE
htree ITEM;
v_ignore NUMBER;
rg_emps RECORDGROUP;
BEGIN
-- Find the tree itself.
htree := Find_Item('tree_block.htree3');
-- Check for the existence of the record group.
rg_emps := Find_Group('emps');
IF NOT Id_Null(rg_emps) THEN
DELETE_GROUP(rg_emps);
END IF;
-- Create the record group.
rg_emps := Create_Group_From_Query('rg_emps',
'select 1, level, ename, NULL, to_char(empno) ' ||
'from emp ' ||
'connect by prior empno = mgr ' ||
'start with job = ''PRESIDENT''');
-- Populate the record group with data.
v_ignore := Populate_Group(rg_emps);
-- Transfer the data from the record group to the hierarchical
-- tree and cause it to display.
Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, rg_emps);
END;
Return to Contents .
|
|
|
|
|
Goto Forum:
Current Time: Sun Feb 09 20:27:00 CST 2025
|