Home » Developer & Programmer » Forms » Combo Box Problem
Combo Box Problem [message #140611] |
Tue, 04 October 2005 23:34  |
bhoite_amol83
Messages: 110 Registered: June 2005 Location: Pune
|
Senior Member |
|
|
Hi Friends,
I have one table.
CREATE TABLE TEMP (ID NUMBER, NAME VARCHAR2 (10));
Records are ;
Insert into temp values (1,’aaa’);
Insert into temp values (2,’bbb’);
Insert into temp values (3,’ccc’);
And I want to get values of id in my ComboBox/ListBox
What can I do for it?
Plz Send me code to get values in combobox;
Thanx for any help .
Amol.
|
|
|
|
|
|
Re: Combo Box Problem [message #141147 is a reply to message #140611] |
Fri, 07 October 2005 03:50   |
bhoite_amol83
Messages: 110 Registered: June 2005 Location: Pune
|
Senior Member |
|
|
Hello David Sir,
I tried with it many times can you plz tell me all coding detail because i am a fresher with oracle forms.
Thanx in advance for any kind of help.
Amol.
|
|
|
Re: Combo Box Problem [message #141361 is a reply to message #141147] |
Sun, 09 October 2005 18:55  |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Create a new form. Create record_group using 'Query Text', "select id, name from temp order by 1". It is called record_group3. Create an LOV using the wizard. Use an existing record group, 'record_group3'. Use 'Modify existing Record Group', then 'next', press 'double arrow', 'next', set width of ID to zero, 'next', set title to 'my_lov', press 'next' three times and then finish. Create block using wizard. Don't display the ID field on the canvas, and create a non-database field which is displayed. Create a Post-Query trigger for this block. Add this code begin
select NAME
into :table_2.item9
from temp
where ID = :table_2.field_3;
exception
when no_data_found then
:table_2.item9 := 'code missing';
when others then
:table_2.item9 := null;
end;
Now go back to the non-database field and add the LOV (it IS simpler to create the block before the Record_group and LOV but I have written it this way so you see the form from a maintenance versus build point of view). Go back to the LOV, click on the 'Column Mapping Porperties', for 'ID' define the 'Return Item' by using the 'Browse' button and select the database item that is NOT on the canvas and which you want populated (leave the display width as zero), select the 'NAME' column and set its 'Return Item' to the non-database field which is on the canvas. Click okay, save, and run. The non-database field displays the 'NAME' data. The LOV shows the 'NAME' data and returns the 'ID' data.
Hope this helps. I have attached the form in Forms 6. Below is the script to create the two tables and to populate them.
David
CREATE TABLE TABLE_2
(
FIELD_1 VARCHAR2(5 BYTE),
FIELD_2 VARCHAR2(5 BYTE),
FIELD_3 NUMBER(5)
)
LOGGING
NOCACHE
NOPARALLEL;
CREATE TABLE TEMP
(
ID NUMBER(3) NOT NULL,
NAME VARCHAR2(30 BYTE) NOT NULL
)
LOGGING
NOCACHE
NOPARALLEL;
INSERT INTO TABLE_2 ( FIELD_1, FIELD_2, FIELD_3 ) VALUES ( 'A', 'AA', 1);
INSERT INTO TABLE_2 ( FIELD_1, FIELD_2, FIELD_3 ) VALUES ( 'B', 'BB', 2);
INSERT INTO TABLE_2 ( FIELD_1, FIELD_2, FIELD_3 ) VALUES ( 'C', 'CC', 3);
INSERT INTO TABLE_2 ( FIELD_1, FIELD_2, FIELD_3 ) VALUES ( 'A', 'AA', 2);
INSERT INTO TABLE_2 ( FIELD_1, FIELD_2, FIELD_3 ) VALUES ( 'B', 'BB', 1);
INSERT INTO TABLE_2 ( FIELD_1, FIELD_2, FIELD_3 ) VALUES ( 'C', 'CC', 4);
COMMIT;
CREATE UNIQUE INDEX PK_TEMP ON TEMP
(ID)
LOGGING
NOPARALLEL;
ALTER TABLE TEMP ADD (
CONSTRAINT PK_TEMP PRIMARY KEY (ID));
INSERT INTO TEMP ( ID, NAME ) VALUES ( 1, 'aaa');
INSERT INTO TEMP ( ID, NAME ) VALUES ( 2, 'bbb');
INSERT INTO TEMP ( ID, NAME ) VALUES ( 3, 'ccc');
COMMIT;
-
Attachment: djm_t3.fmb
(Size: 48.00KB, Downloaded 1066 times)
[Updated on: Sun, 09 October 2005 18:56] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Mar 06 10:41:26 CST 2025
|