HOW TO MAKE THE FORMS6 TREE WORK

From: <james_rowland_at_my-deja.com>
Date: Thu, 06 Jan 2000 17:25:25 GMT
Message-ID: <852j5h$3s2$1_at_nnrp1.deja.com>



After reading many of the postings here, looking for documentation and beating my brain on how to use the new forms 6.0 hierarchial tree, I thought I would share my findings with the rest of you so you won't have to go through what I did.

I hope it helps.

James Rowland (jrowland_at_chis.com)

  • TO Sequel Solutions *** It is great that you offer an OCX but several of the questions that you answered where how to use the existing control in Oracle not yours. -- please no advertisements --


The scenario

Our system has several reports and I wanted to be able to present the user with a list of these reports in a tree view based on categories. Here is how I did it.

Step 1 - Create and populate the table

CREATE TABLE REPORTS

(	ID      NUMBER(3),
	RPTNUM	NUMBER(3),
	NAME    varCHAR(40),
	PARENT	NUMBER(3),
	DES	varCHAR(255)

);

INSERT INTO REPORTS VALUES
(1, NULL, 'Finance', NULL, NULL);

INSERT INTO REPORTS VALUES
(2, NULL, 'Membership', NULL, NULL);

INSERT INTO REPORTS VALUES
(3, NULL, 'Referrals', NULL, NULL);

INSERT INTO REPORTS VALUES
(4, NULL, 'Weekly Remittance', 1, 'Prints a listing of weekly activity');

INSERT INTO REPORTS VALUES
(5, NULL, 'Member List', 2, 'Prints a list of current members');

INSERT INTO REPORTS VALUES
(6, NULL, 'Superceded Referrals', 3, 'Prints a list of superceded referrals');



Step 2 - Create a record group.

Create a record group named RG1.

Set the record group query property to:

	SELECT -1, level, name, null, name
		FROM reports
		CONNECT BY PRIOR ID = parent
		START WITH parent IS NULL


-------------------------------

Step 3 - Add the Hierarchial Tree control and set properties.

Name the tree HTREE3.

  • The tree control must be the only item in the block. **

Name the data block TREE_BLOCK.

Set the following data BLOCK (TREE_BLOCK) properties:

	Database data block		NO
	Query data source 		None
	Number of record displayed	1

Set the TREE control (HTREE3) properties:

        Record group RG1



Step 4 - Add a trigger

Add the following code to the either the PRE-FORM, WHEN-NEW-FORM- INSTANCE, or WHEN-NEW-BLOCK-INSTANCE trigger.

        DECLARE

	   htree         ITEM;
	   v_ignore      NUMBER;

	BEGIN

	   -- Find the tree itself.

	   htree := Find_Item('TREE_BLOCK.HTREE3');

	   -- Populate the record group.

	   v_ignore := Populate_Group('RG1');

	   -- Assign the record group to the tree

	   Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, 'RG1');

	END;



-------------------------------

Step 5 - Run the form

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Jan 06 2000 - 18:25:25 CET

Original text of this message