How can I display dynamic LOV ? [message #262979] |
Tue, 28 August 2007 12:48 |
aftab248
Messages: 14 Registered: August 2007 Location: Bangladesh
|
Junior Member |
|
|
Hello Everyone
I want to create dynamic Lov. How can I create it? For practice I create a LOV at design time RECORD_GROUP_QUERY value: SELECT * FROM
EMP. THEN I write some code in WHEN-BUTTON-PRESSED Trigger to replace RECORD_GROUP_QUERY at run time. Code is:
........
v_rg_id:=CREATE_GROUP_FROM_QUERY('TEST','SELECT * FROM DEPT');
........
After this I found a error at run time which is
FRM-41826: Cannot replace group; columns don't match LOV.
I need it very much.If any solution,please tell me with example.
Best Wishes
Aftab
|
|
|
|
|
Re: How can I display dynamic LOV ? [message #272373 is a reply to message #262979] |
Thu, 04 October 2007 15:33 |
mailsush
Messages: 4 Registered: July 2005 Location: Bangalore
|
Junior Member |
|
|
Hi,
Follow the below steps to create dynamic LOV,
1. Create a Record Group(RG)
2. Create RG SQL Query as
Select 1,2,3,4,5 from dual;
Make sure you set the datatype accordingly w.r.t your col in the dynamic query to be used in the below package.
Here 1,2,3,4,5 represents the number of columns for your query
3. Create an LOV an attach this RG to it
4. Add the below logic to the trigger,
CLick on the field to which LOV is attached. it will show up.
DECLARE
result Number;
rec_id RecordGroup;
rwcnt NUMBER;
p_lovname VARCHAR2(40);
p_rg_name VARCHAR2(40);
lc_query VARCHAR2(1000);
BEGIN
p_lovname := <LOV_name>
p_rg_name := <RG_Name>
lc_query:= 'SELECT
item_name
,desc ,Attr1
,Attr2
,Attr3
from <Your tab name>;
rec_id := find_Group(p_rg_name );
result := POPULATE_GROUP_WITH_QUERY(rec_id, lc_query);
rwcnt := Get_Group_Row_Count(rec_id);
SET_LOV_PROPERTY(p_lovname, GROUP_NAME, rec_id);
END;
This should work for you.
Regards,
Mailsush
|
|
|
|
Re: How can I display dynamic LOV ? [message #272703 is a reply to message #262979] |
Sat, 06 October 2007 06:08 |
anisam10674
Messages: 18 Registered: March 2007
|
Junior Member |
|
|
Maybe creation of a record_group at runtime using create_group_from_query() and then assigned to the LOV using set_lov_property() can solve most of your queries. After that you can manipulate the LOV properties
|
|
|
|