Solved

Oracle Forms 6i: Tabbed Canvas

Posted on 2003-10-22
17
12,104 Views
Last Modified: 2011-08-18
I am having trouble with tabbed forms.  This is what I want to do.  I have a table with about 60 fields.  I have created a tab control that holds all these fields.  It works great.  However, I cannot seem to figure out a way to insert a combo box outside of the tabbed control that lists the unique information for each record.  This way the user can select a record from the combo box and then the form will display all the fields for that selected record on the tabbed control.

So let's us the Vendor table.  I want a combo box listing the vendor name.  The user picks the vendor name whose data they want to look at.  Once the vendor name has been choosen, then the fields will be filled in on the tabbed control.
0
Comment
Question by:DCCoolBreeze
  • 10
  • 7
17 Comments
 
LVL 5

Expert Comment

by:FBIAGENT
Comment Utility
DCCoolBreeze,

You could do the followings,

1. Create a control (non-based-table) block CONTROL_BLK with one control item VENDOR_LIST(type NUMBER), which is the combo box listing all the vendor name.
2. Create a record-group RG_VENDOR_LIST with the following query, assume that table Vendor will have at least two(2) columns vendor_name (VARCHAR2) (name of the vendor) and vendor_id (NUMBER)(unique id of the vendor, also the primary key),

select vendor_name label, vendor_id value
  from vendor
 order by vendor_name

3. Add the following logic in the form-level WHEN-NEW-FORM-INSTANCE

declare
...
   return_value number;
...
begin
   ...
   -- populate the combo box
   return_value := populate_group('rg_vendor_list');
   populate_list('control_blk.vendor_list', 'rg_vendor_list');

   -- set the combo box to the first vendor
   :control_blk.vendor_list := get_group_char_cell('rg_vendor_list.value', 1);

   ...
end;

4. Create the item-level trigger WHEN-LIST-CHANGED for the VENDOR_LIST item in control block CONTROL_BLK with the following logic

declare
   default_where_clause varchar2(2000);
begin
   -- post any changes made by the user to the currently displayed vendor
   -- or prompt the user to save changes made by the user to the currently displayed vendor
   ...

   -- change the default where clause for the data block containing the vendor info (on your tab canvas)
   default_where_clause := 'vendor_id = '||to_char(:control_blk.vendor_id);
   set_block_property('VENDOR_BLK', default_where, default_where_clause);

   -- query the vendor information (on your tab canvas)
   :system.message_level := 5;
   go_block('VENDOR_BLK');
   execute_query;
   :system.message_level := 0;

end;
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
I added the code as requested but when I run the form, I get the following error.  I have tested the query and it returns records...

FRM-30351: No list elements defined for list item.

There are lots of records if I run the query stand-alone
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
OK.  I solved the error problem.
0
 
LVL 5

Accepted Solution

by:
FBIAGENT earned 500 total points
Comment Utility
FRM-30351 is a warning, but you should still be able to run the form.
To correct the problem, you just have to define a dummy element in the control item VENDOR_LIST, by specifying 'x' in the List Elements and 1 in the List Item Value for the first element of the combo box control item VENDOR_LIST

Also correction in the WHEN-LIST-CHANGED trigger

   -- change the default where clause for the data block containing the vendor info (on your tab canvas)
   default_where_clause := 'vendor_id = '||to_char(:control_blk.VENDOR_LIST); <<<< NOT VENDOR_ID
   set_block_property('VENDOR_BLK', default_where, default_where_clause);
 
good luck
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
OK.  The final item is how can I cause this combo box to appear with the tabbed control.  I do not want it on the tabbed control but I would like to to show.  Then the user can select records from the combox box and the tabbed fields will be filled...but the combo box will remain.  Fror example:

 Form 1
 |--------------------------------------------------------------------------------------------|
 |                                                 TITLE                                                          |
 |  Vendor: name (combo box here on the form)                                                |
 |                                                                                                                   |
 |  Data for vendor                                                                                           |
 |                                                                                                                   |
 |  tab1  tab2 tab3 ... (tabbed control here)                                                        |
 |                                                                                                                   |
 |                                                                                                                   |
 |--------------------------------------------------------------------------------------------|
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
I got the following error: FRM-41336: Populate_list: invlaid column type for column 2.  I was able to get rid of that error by changing the second column in my SQL statement from NUMBER to charcter using TO_CHAR().
0
 
LVL 5

Expert Comment

by:FBIAGENT
Comment Utility
Sorry but your request is not clearly understood.
You could have a document canvas MAIN_CANVAS, on which the tab canvas TAB_CANVAS1 will overlay.
Then you can put the combo box on the MAIN_CANVAS; e.g., see rough sketch below

+------------------------------------+
|combo box here                       |
|                                              |
|+-------+                                 |
||         +-------------------------+|
||       (this is the tab canvas)  | |
||                                          | |
|+---------------------------------+ |
+------------------------------------+
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
You do understand what I am trying to do.  Let me try that.  Currently I have a stacked canvas and a tabbed canvas.  The window property primary canvas calls the stacked canvas
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
How do I overlay one canvas with the next??
0
 
LVL 5

Expert Comment

by:FBIAGENT
Comment Utility
Since the MAIN_CANVAS is the sole document canvas on the form, it will always be shown regardless.
Your tab canvas TAB_CANVAS1 can overlay the MAIN_CANVAS via

show_view('tab_canvas1');  -- place this logic in the WHEN-NEW-FORM-INSTANCE, near the end
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
hmmm.  I tried this and it did not work.  I am new to Oracle Forms so I am sure it is something I do not have setup correctly.  So I have one window defined as a document.  I have one canvas defined as a tab and one canvas defined as a content.  I removed the stacked canvas.  I could not see any place where you define a canvas as document.  When I run the app, I get VENDOR_NAME (name of canvas) but no VENDOR_DATA tab canvas.
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
Alright cool.  I got the tabbed canvas to display on the main canvas.  I still have a few more bugs to work out for example, when I load the form I get a ORA-41084: Error getting group cell and then when I select a vendor name I get ORA-40505: unable to perform query.
0
 
LVL 5

Expert Comment

by:FBIAGENT
Comment Utility
My mistake when I said the MAIN_CANVAS be defined as document canvas; it should be Content, not Document.
What you may need to specify the  Display X Position and Display Y Position properties of the tab convas to values other than zero and zero.  Make sure that the Display Y Position is below that of the combo box.
0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
You were exacly right.  They were overlaying each other. I just fixed the first error (ora-41084).  forgot to correct the statement to point to the field in question...working on the last error
0
 
LVL 5

Expert Comment

by:FBIAGENT
Comment Utility
Did you make the correction in previous post

Also correction in the WHEN-LIST-CHANGED trigger

   -- change the default where clause for the data block containing the vendor info (on your tab canvas)
   default_where_clause := 'vendor_id = '||to_char(:control_blk.VENDOR_LIST); <<<< NOT VENDOR_ID
   set_block_property('VENDOR_BLK', default_where, default_where_clause);

0
 
LVL 1

Author Comment

by:DCCoolBreeze
Comment Utility
perfect!  oustanding help!  Thanks FBIAGENT!
0
 
LVL 5

Expert Comment

by:FBIAGENT
Comment Utility
glad it helped.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to recover a database from a user managed backup

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now