Home » Developer & Programmer » Forms » How to create LOV dyanamically at run time
How to create LOV dyanamically at run time [message #290569] Sat, 29 December 2007 23:59 Go to next message
sachinbpl
Messages: 11
Registered: August 2007
Junior Member
I am developing a form in which i want to dynamically populate LOV based on the value of atext item.When the text item changes the LOV values should change accordingly.Please give a sample code.Any help is highly appreciated.
Re: How to create LOV dyanamically at run time [message #290571 is a reply to message #290569] Sun, 30 December 2007 00:09 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Dynamic record groups can be created/populated using create_group
Use populate_list to populate the group.

You can have the above code using your conditions in the when-validate-item of the text item.

By
Vamsi
Re: How to create LOV dyanamically at run time [message #290573 is a reply to message #290571] Sun, 30 December 2007 00:20 Go to previous messageGo to next message
sachinbpl
Messages: 11
Registered: August 2007
Junior Member
Thanks Vamsi for the very prompt reply.I have following code in POST-TEXT-ITEM trigger of the text item:
DECLARE
rg_name VARCHAR2(20) := 'LEASE_RG';
rg_id RECORDGROUP;
err_code NUMBER;
con_num VARCHAR2(40) ;
--item_id ITEM := FIND_ITEM('XXCONTRACTS_ADDITIONAL_FIELDS.LEASE_NUMBER');
lov_id LOV;
qry VARCHAR2(1000);
BEGIN
con_num := :XXCONTRACTS_ADDITIONAL_FIELDS.CONTRACT_NUMBER;

qry :='SELECT to_char(lease_number) LEASE_NUMBER,to_char(lease_number)'||
' FROM xxcontracts_additional_fields '||
' WHERE contract_number LIKE ''%'||con_num||'%''';

MESSAGE('con_num= ' || con_num);
MESSAGE(qry);
lov_id := FIND_LOV('LEASE_NUMBER');
rg_id := FIND_GROUP(rg_name);
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
rg_id := CREATE_GROUP_FROM_QUERY(rg_name,qry);
DELETE_GROUP_ROW(rg_id, ALL_ROWS);
err_code := POPULATE_GROUP(rg_name);
--CLEAR_LIST(list_id);
-- POPULATE_LIST(list_id,rg_id);
SET_LOV_PROPERTY(lov_id,rg_name);

END;
I hv created an LOV LEASE_NUMBER and record group which selects all lease numbers to associate with the LOV bcoz if I dont hv RG associated with LOV it gives an error .This is giving me error FRM 40735POSt-TEXT_item trigger raised unhandled exception
ORA 06508
Please suggest where am I going wrong.ITs urgent I have to get form working immediately.Thanks

Re: How to create LOV dyanamically at run time [message #290575 is a reply to message #290573] Sun, 30 December 2007 01:00 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Hope your messages are showing the contract_number and the query correctly.

Try to display lov_id and err_code. Paste the exact error message.

By
Vamsi

[Updated on: Sun, 30 December 2007 01:00]

Report message to a moderator

Re: How to create LOV dyanamically at run time [message #290609 is a reply to message #290575] Sun, 30 December 2007 10:29 Go to previous messageGo to next message
sachinbpl
Messages: 11
Registered: August 2007
Junior Member
ORA-01403: no data found

--------------------------------------------------------------
FRM-40735: POST-TEXT-ITEM trigger raised unhandled exception ORA-06502.

This is the exact error.The query is formed correctly.
err_code=0

Please suggest
Re: How to create LOV dyanamically at run time [message #290637 is a reply to message #290609] Sun, 30 December 2007 23:55 Go to previous message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Write your code in when-validate-item and put more debug messages as you can.

By
Vamsi
Previous Topic: I want when I press Esc from keyboard exit from form
Next Topic: Displaying message without pressing the commit button
Goto Forum:
  


Current Time: Thu Apr 25 16:13:05 CDT 2024