Home » Developer & Programmer » Forms » How can I display dynamic LOV ?
How can I display dynamic LOV ? [message #262979] Tue, 28 August 2007 12:48 Go to next message
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 #263009 is a reply to message #262979] Tue, 28 August 2007 14:26 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
Cannot replace group; columns don't match LOV.

Those two queries do not return the same column set. It *might* work if the first query was something like
SELECT empno, ename, job
FROM emp
and another one
SELECT deptno ename, dname ename, loc job
FROM dept
Note column aliases I used; I can't test it at the moment, so maybe such a column mapping isn't necessary.
Re: How can I display dynamic LOV ? [message #263053 is a reply to message #262979] Tue, 28 August 2007 23:16 Go to previous messageGo to next message
azamkhan
Messages: 557
Registered: August 2005
Senior Member
In the select query specify the column names and in LOV property also specify the column.

Regards,
Azam Khan
Re: How can I display dynamic LOV ? [message #272373 is a reply to message #262979] Thu, 04 October 2007 15:33 Go to previous messageGo to next message
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 #272666 is a reply to message #272373] Fri, 05 October 2007 22:08 Go to previous messageGo to next message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Helo,

You can follow below way for dynamic LOV creating and populating:


step 1: create a RECORD GROUP First named REC1 as follows:

Click "Record Groups" Node at object Navigator and Click Create and name it as "REC1"
and double Click the REC1 and go to "Record Group Query" type the following Query Command:


SELECT EMPNO,ENAME,
FROM EMP
WHERE DEPTNO=:EMP.DEPTNO order by empno asc



Step: 2 Click LOV node from object navigator and create a LOV Named E_LOV
double click to LOV and go to its "Record Group" Property and select "REC1"

now creat a pushbutton to call the lov and type the following code to call LOV

-----------------
declare
x boolean;

begin
x:=show_lov('E_LOV');
end;

i think it will help you

Best Regards


------------------
Re: How can I display dynamic LOV ? [message #272703 is a reply to message #262979] Sat, 06 October 2007 06:08 Go to previous messageGo to next message
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
icon14.gif  Re: How can I display dynamic LOV ? [message #571752 is a reply to message #272373] Thu, 29 November 2012 22:48 Go to previous message
tianpan
Messages: 1
Registered: August 2012
Location: China
Junior Member
Mailsush's post is helpful for me.Tks
Previous Topic: Adding a Save (Update) button
Next Topic: Logo & Home Page Picture Quality
Goto Forum:
  


Current Time: Thu Apr 25 19:10:17 CDT 2024