Change lov record group dynamilcally
Please provide me solution :-
declare
l_id lov;
rg_id recordgroup;
n boolean;
begin
l_id := find_lov('LOV14');
rg_id := find_group('LOV14');
if get_lov_property('LOV14',group_name) = 'LOV14' then
message('found');
message('found');
-- end if;
-- if not id_null(rg_id) then
-- delete_group(rg_id);
set_lov_property(l_id ,group_name, 'NEW_RG');
-- message('group has been changed');
-- message('group has been changed');
n:= show_lov('LOV14');
end if;
end;
i tried this code . but neither its giving error nor doing work. please help me
thanks for reply sir, bt problem is :---
my lov name is 'LOV14' and same name as record group 'LOV14' , now i hav to button on my form ;
i want to show lov at button first . as well as i want change record group dynamicly at button second.
first record group name is "LOV14' and another is "NEW_RG'. and run time i want to change NEW_RG record group at the place of LOV14.
declare
l_id lov;
rg_id recordgroup;
n boolean;
x number;
begin
l_id := find_lov('LOV14');
rg_id := find_group('LOV14');
if get_lov_property('LOV14',group_name) = 'LOV14' then
message('found');
message('found');
-- end if;
--x := POPULATE_GROUP('NEW_RG');
-- if not id_null(rg_id) then
-- delete_group(rg_id);
if not id_null (rg_id) then
delete_group(rg_id);
end if;
set_lov_property(l_id ,group_name, 'NEW_RG');
-- message('group has been changed');
-- message('group has been changed');
-- n:= show_lov('LOV14');
end if;
end;
Similar Messages
-
Can we change the Record Group Type through Custom.pll
Hello All,
I have a small requirement on Changing the Record Group Dynamically.
Can i set the Record group type to 'Query' from 'Static'. i.e Can i change the Record group type dynamically through custom.pll. I know that we can dynamically change the Record group query.
Please help me its a bit urgent.
Thanks inadvance,
Amarnadh Jsyou can control your record group runtime without create any recordgroup at design time..
1.static group
declare
rg_name VARCHAR2 (40) := 'Global_Rgp_Menu'; --global record group name for menu use
rg_id recordgroup; --global record group id
gc_id groupcolumn; --global record group coulmn id
errcode NUMBER; --error code
grp_row PLS_INTEGER := 0; --global record group row count
begin
rg_id := FIND_GROUP (rg_name);
IF NOT ID_NULL (rg_id)
THEN
DELETE_GROUP_ROW (rg_id, all_rows);
ELSE
rg_id := CREATE_GROUP (rg_name, global_scope);
gc_id := ADD_GROUP_COLUMN (rg_id, 'menu_item', char_column, 100);
gc_id := ADD_GROUP_COLUMN (rg_id, 'p_type', char_column, 100);
gc_id := ADD_GROUP_COLUMN (rg_id, 'p_no', char_column, 100);
END IF;
grp_row := 0;
for 1 in 1..10 loop
grp_row := grp_row + 1;
ADD_GROUP_ROW (rg_id, grp_row);
SET_GROUP_CHAR_CELL (rg_name || '.menu_item', grp_row, 'menu' || to_char(i) );
/*type*/
SET_GROUP_CHAR_CELL (rg_name || '.p_type', grp_row, 'type' || to_char(i) );
/*program_no */
SET_GROUP_CHAR_CELL (rg_name || '.p_no', grp_row, 'programno' || to_char(i) );
end loop;
end;
2. query group
declare
FACT_SQL VARCHAR2(500) :=NULL;
rg_name1 VARCHAR2(40) := 'Global_Rgp_fact';
rg_id1 RecordGroup;
Error_Flag number:=0;
group_error exception;
begin
rg_id1 := Find_Group( rg_name1 ); IF NOT Id_Null(rg_id1) THEN Delete_Group( rg_id1 ); END IF;
FACT_SQL := ' SELECT * FROM MYFACTORY ' ;
rg_id1 := Create_Group_From_Query( rg_name1,FACT_SQL ,global_scope);
Error_Flag := POPULATE_GROUP(rg_id1);
IF Error_Flag <>0 THEN
error_msg:='Error while populating factory group';
raise group_error;
END IF;
exception
when group_error then
message(error_msg);
raise;
end;Edited by: nolemlin on 2010/3/23 上午 7:50 -
Changing the record group query in seeded forms
Hi all,
I need to change the record group query in one seeded form.
Can it be done through custom pll or what is the correct approach to do that..
Thanks,
Devangyou want to do that at runtime?
-
Hi
I have to achieve this task.
I have "company_list" record group and "company_list" lov
I am form layout style. I am in Enter-query. Then give some value to any field. Then Click execute-query. Its retreiving some records.
Now if I click the LOV can I show only those records currently I have retreived.
I have following trigger on button pressed.
It is giving 1)error Populating group.2)cannot create group company_list 3) error_populating group.
Anybody pl help me.
Christy.
DECLARE
cur_blk VARCHAR2(40) := :System.Cursor_Block;
last_qry varchar2(2000);
bk_id Block;
rg_name VARCHAR2(40) := 'COMPANY_LIST';
rg_id RecordGroup;
errcode number;
BEGIN
bk_id := Find_Block(cur_blk);
last_qry := Get_Block_Property( bk_id, LAST_QUERY);
rg_id := Find_Group('COMPANY_LIST');
IF NOT Id_Null(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
rg_id := Create_Group(rg_name);
errcode:=Populate_Group_With_Query(rg_id,last_qry);
end;I think that you have to use Create_Group_From_Query() instead of Create_Group():
rg_id := Create_Group_From_Query(rg_name);
Helena
null -
Please explain me step by step to create dynamic record group and populate it into my combo box.
thanks
rupal
Edited by: rupearlkaushal on Jun 13, 2012 9:39 PMhi
plz check out the following threads.
Dynamic creation of record group
and
Dynamic Record Group
LOV (List of Values)
LOV is nothing but a form item which is used to provide list of values to a text field.
Each LOV contains a Record Group which provides the data to the LOV
Record Group
A record groups contains the query which is used to populate the values to the LOV.
To alter a list of values(LOV) of a text field, we should change the query of the
record group which is attached to the corresponding LOV or we should create a
new record group and attach it to the existing LOV.
Note : We cant create a new LOV. But we can attach a exsiting LOV to a form field.Method 1: Changing the query of the existing Record group
declare
rg_id RECORDGROUP ;
err number;
lv_id lov;
begin
rg_id:=find_group('LOV4'); -- LOV4 is the name of the existing LOV
if not id_null(rg_id) then
err:=populate_group_with_query(rg_id,
'select deptno from dept where dname=''SALES''');
end if;
lv_id:=find_lov('LOV4');
set_lov_property(lv_id,group_name,rg_id);Method 2: Creating a new Record Group if doesn't exists
declare
rg_id recordgroup;
pg_num number;
lv_id lov;
begin
rg_id:=find_group('MYGROUP'); -- MYGROUP is the Group Name
if id_null(rg_id) then
rg_id:=create_group_from_query('MYGROUP','SELECT 100 deptno FROM dual');
end if;
pg_num:=populate_group(rg_id);
lv_id:=find_lov('LOV4');sarah
Edited by: Sarah on Jun 13, 2012 9:56 PM -
Using JDAPI to manipulate record group
Hi.
I am doing a migration from oracle forms 4.5 to 10g. For now I was able to manage/fix everyting using JDAPI interface. Now I am stuck with the following problem. In forms 4.5 it was perfectly legal to use a value of record group column larger than data length of that column. From forms 6+ there is a runtime error generated when this situation is met. What I wanted to do is to change/truncate record group value to the length of that column using JDAPI. No matter how I search I cant find proper metod to do the job. That is to change the value of record group column. Did anybody had a similar situation and was able to solve it.
Best regards.Hi.
I am doing a migration from oracle forms 4.5 to 10g. For now I was able to manage/fix everyting using JDAPI interface. Now I am stuck with the following problem. In forms 4.5 it was perfectly legal to use a value of record group column larger than data length of that column. From forms 6+ there is a runtime error generated when this situation is met. What I wanted to do is to change/truncate record group value to the length of that column using JDAPI. No matter how I search I cant find proper metod to do the job. That is to change the value of record group column. Did anybody had a similar situation and was able to solve it.
Best regards. -
I have two LOV s one in the mainform and one in the subform. If I select one category from the list in the mainform LOV. In the subform LOV has to change it's record group (3 record groups) depending on the category selected in the mainform LOV. Please help. I am pasting the code I wrote. I tried it in the NEW ITEM INSTANCE TRIGGER, NEW BLOCK INSTANCE TRIGGER (datablock for the 2nd LOV with 3 record groups) and in the NEW FORM INSTANCE TRIGGER. Please help. Thank you.
DECLARE
lov_id1 LOV;
--val boolean;
rg_id1 RECORDGROUP;
rg_id2 RECORDGROUP;
rg_id3 RECORDGROUP;
BEGIN
lov_id1 := FIND_LOV ('ACTIVITYTYPE_LOV');
rg_id1 := FIND_GROUP('ACTIVITYTYPE_RG1');
rg_id2 := FIND_GROUP('ACTIVITYTYPE_RG2');
rg_id3 := FIND_GROUP('ACTIVITYTYPE_RG3');
-- val := SHOW_LOV(lov_id1, 32, 48);
IF
GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1' AND :YOUTH_GOALS.GOAL_TYPE = 'EXIT COUNSELING'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id1');
ELSIF
GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1' AND :YOUTH_GOALS.GOAL_TYPE = 'COMPLETE TRAINING'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id1');
ELSIF
GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1' AND :YOUTH_GOALS.GOAL_TYPE = 'VOCATIONAL TRAINING'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'GRADUATE FROM HIGH SCHOOL'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'IMPROVE ACADEMIC PERFORMANCE'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'OBTAIN GED'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'NON-ACADEMIC'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id3');
END IF;
end;try on when-validate-item or on POST-CHANGE
Regards,
Danish Hayder -
Dynamically populate a record group on the fly uisng LOV
Hi,
I want to create dynamically populate a record group on the fly uisng LOV.
1. This is how the RG_BANKNAME Record Group object look like
Object : Record Group
Name : RG_BANKNAME
Record Group Query : SELECT NAME, SHORT_NAME FROM C_BANKS
2. I create the Push Button and when user click it will popup the LOV.
DECLARE
rg_id RecordGroup;
errcode NUMBER;
status BOOLEAN;
BEGIN
rg_id := Find_Group('RG_BANKNAME');
IF Id_Null(rg_id) THEN
Message('No such group: ',ACKNOWLEDGE);
RAISE Form_Trigger_Failure;
ELSE
errcode :=POPULATE_GROUP(rg_id);
SET_LOV_PROPERTY('LV_NAME', TITLE, 'My Own LOV');
SET_LOV_PROPERTY('LV_NAME', GROUP_NAME, rg_id);
SET_LOV_COLUMN_PROPERTY('LV_NAME', 1 ,Title, 'NAME');
SET_LOV_COLUMN_PROPERTY('LV_NAME', 1 ,Width, 150);
SET_LOV_COLUMN_PROPERTY('LV_NAME', 2 ,Title, 'SHORT NAME');
SET_LOV_COLUMN_PROPERTY('LV_NAME', 2 ,Width, 100);
status := Show_LOV('LV_NAME',10,20);
IF NOT status THEN
Message('You have not selected a value.');
Bell;
END IF;
END IF;
END;
My question is do I need to create the LOV Object name call 'LV_NAME'? since I don't have this
create on my design times, because I thought it can be done dynamically on the fly.
The problem is compliant that the Lov Id is not valid.
Thanks
David
Edited by: user445990 on May 24, 2011 9:19 PMHello,
You request is not clear. Do you need to display the LOV or not ? In other words, what is the goal of your record group ?
Francois -
Creation of Record Group and LOV at run time
Hello All,
I have been stuck by this...I have two text items on which LOVs have been placed.Selection of one depends on selection of other.I can dynamically create a record group but how to create a LOV dynamically to populate it with the dynamic record group been created.
For more visualization consider that filtering of data takes place in one lOV based on the other LOV been provided.
Revert ASAP...
Thanks and Regards,
Kapil UppalI don't think you can create a LOV dynamically, but you can repopulate a pre-existing one, which should allow you to achieve the same goal.
-
(urgent) Dynamic record groups and LOV
I have to create a record group and then add 2 rows to it manually.Following is the code.There are no values displayed in the lov.Please help.
PROCEDURE create_record_group IS
BEGIN
DECLARE
rg varchar2(40) := 'test_fips';
rg_id RECORDGROUP;
lov_id Lov;
err NUMBER;
gc_id1 GROUPCOLUMN;
gc_id2 GROUPCOLUMN;
counter number;
BEGIN
rg_id := FIND_GROUP(rg);
lov_id := FIND_LOV('LOV_FIPS');
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
IF ID_NULL(rg_id) THEN
rg_id := CREATE_GROUP(rg);
gc_id1 := add_group_column (rg_id,'col1',number_column);
gc_id2 := add_group_column(rg_id,'col2',char_column,40);
END IF;
/* adding static content to LOV */
ADD_GROUP_ROW( rg_id,1);
SET_GROUP_NUMBER_CELL(gc_id1,1,997);
SET_GROUP_CHAR_CELL(gc_id2,1,'MLAB');
counter := get_group_row_count(rg_id);
/* adding dynamic content */
FOR rec in (SELECT FIPS_CD COL1, LOCNAME COL2 FROM FIPS) LOOP
counter := counter +1 ;
ADD_GROUP_ROW( rg_id, counter);
SET_GROUP_NUMBER_CELL(gc_id1,counter,rec.col1);
SET_GROUP_CHAR_CELL(gc_id2,counter,rec.col2);
END LOOP;
SET_LOV_PROPERTY('LOV_FIPS',GROUP_NAME, rg);
END;
END;I tried creating the group the way you suggested but it does not seem to work because of 'UNION' in the query.It says unable to create rcord group.Did you anytime use the 'UNION' option while creating record group.
While creating record group at design time also you cannot use UNION with dual.
This how I modified :
PROCEDURE create_record_group IS
BEGIN
DECLARE
V_RG_ID RECORDGROUP;
RG_NAME VARCHAR2(20) := 'TEST_FIPS';
V_ERRCODE NUMBER;
BEGIN
V_RG_ID := FIND_GROUP('TEST_FIPS');
IF ID_NULL(V_RG_ID) THEN
V_RG_ID := CREATE_GROUP_FROM_QUERY('TEST_FIPS', 'SELECT FIPS_CD, LOCNAME FROM FIPS
UNION SELECT 997,'MLAB' FROM DUAL');
END IF;
V_ERRCODE := POPULATE_GROUP(V_RG_ID);
MESSAGE('CREATED '|| V_ERRCODE);
SET_LOV_PROPERTY('LOV_FIPS',GROUP_NAME, RG_NAME);
END;
END;
Notice here 'MLAB' is char and I get compilation error if I use these quotes with MLAB.But is I remove the quotes the it compiles.
Thanks -
Static record group and lov problem
hi all,
1)I created a form module
2)created a basic datablock based on empno and ename from emp table.
3) created a static record group ,where i specified the column name as col1,provided the values as 1 ,2,3,4,5 etc
4) created an LOV and assigned the above record group to the LOV
5) then assigned the lov to the emp.empno item in the datablock emp....
when i run the form .....i get the list of values message on the console (bottom end of the window) ....
but I am not able to see the LOV when i press the cntrl L or see it from the edit menu command ?
what must be the problem ?
ta
sDear,
May be you don't set LOV's "Column Mapping Properties". After setting the properties correctly you will be able to display LOV.
Thanks. -
One LOV multiple Record Groups
Hi all
I have 2 text items text A and Text B
on text A i have a list with two items Say 'cricket' and 'football'
I have two record groups 'Cricket' and 'football'
If i select 'cricket' from text A then the LOV for text B should have the 'Cricket' record group attached
and if i select 'football' from text A then the LOV for text B should have the football record Group attached
Please tell me how to do it
Thanks in advanceHi,
why don't you just create two LOV's and exchange them on the fly?
WHEN-VALIDATE-ITEM Trigger on "A" :
IF( :A = 'cricket' )
THEN
set_item_property( 'B', LOV_NAME, 'Cricket' );
ELSIF( :A = 'football' )
THEN
set_item_property( 'B', LOV_NAME, 'Football' );
ELSE
set_item_property( 'B', LOV_NAME, NULL );
END IF;
Another possibility would be to create a KEY-LISTVAL Trigger on "B" use "show_lov" to switch between both LOV's.
Regards
Markus -
HI
I have a question regarding LOV's.
I have 2 fields dept_code which is a checkbox and field2 which is an LOV displaying the employee names based on the dept_code selected.
My record group has a query like this -
SELECT empname FROM emp WHERE dept_code IN(:parameter.P_dept_code). p_dept_code is char.
If the user enters multiple department codes then my p_dept_code should contain commas and single quotes for each department like this ('m10','m20')
In which trigger do I do this coding and how do I do it?
Thanks.Hi
Thanks for your response.
The key-listval does'nt seem to firing.
When I run the form the lov comes up but displays the value 2 which is from the default record group(select 1 "dno", 2 "ename" from dual).
This is the code in my key-listval -
DECLARE
rg_name VARCHAR2(40) := 'name_rg';
rg_id RecordGroup;
gc_id GroupColumn;
errcode NUMBER;
BEGIN
rg_id := Find_Group(rg_name);
IF Id_Null(rg_id) THEN
rg_id := Create_Group(rg_name);
gc_id := Add_Group_Column(rg_id, 'dno',
CHAR_COLUMN,10);
gc_id := Add_Group_Column(rg_id, 'empno',
CHAR_COLUMN,100);
END IF;
:parameter.p_dno := ''''||replace(:parameter.p_dno,',',''',''')||'''';
errcode := Populate_Group_With_Query( rg_id,
'select dno dno, ename ename from emp1 where dno in ('|| :parameter.p_dno|| ')' );
set_lov_property('name_lov', GROUP_NAME, rg_name);
list_values;
message(errcode);
END;
Please let me know what I'm doing wrong
TIA -
Assigning different record groups to a single LOV
I have an LOV named as ship_refrence and this is how i display
DECLARE
a_value_chosen BOOLEAN;
BEGIN
a_value_chosen := Show_Lov('ship_refrence');
END; and the corresponding query for
the RG1 is
SELECT ALL TBLOBLIGATION.MATID, TBLOBLIGATION.MATCODE, TBLOBLIGATION.DESCRIPTION,
TBLOBLIGATION.PARTNO, TBLOBLIGATION.DESCRIPTION1, TBLOBLIGATION.PARTNO1, TBLOBLIGATION.MANUFACTURER,
TBLOBLIGATION.NETYPE, TBLOBLIGATION.CAT2, TBLOBLIGATION.CAT3,
TBLOBLIGATION.CAT5, TBLOBLIGATION.CAT6, TBLOBLIGATION.CAT7, TBLOBLIGATION.COMMCODE,
TBLOBLIGATION.NSMCODE, TBLOBLIGATION.UNIT_TYPE_ID
FROM TBLOBLIGATION Now i have created
RG2
select matcode,description,partno1,description1,partno1 from tblobligation where cat2!='C'
RG3
select matcode,description,partno1,description1,partno1 from tblobligation where cat2='C'now the thing is I want my default LOV which has been using rg1 to use RG2 if the billtype is 'Send it to site' or else use RG3 if it is 'Send it to Consumed'
Edited by: Suhail Faraaz on Jan 29, 2011 12:35 AMi have solved it.. by creating 3 different LOV for the record group and under when button pressed i have written this
Declare
a_value_chosen BOOLEAN;
BEGIN
if
:shipbill.billtype
in ('Send it to staff','Send it to store','send it to repair','Received from staff','Received from site','Received from store','Received from STC')
then
a_value_chosen := Show_Lov('ship_refrence');
else
if :shipbill.billtype='Send it to site'
then
a_value_chosen :=Show_Lov('RG_SITE');
else
if
:shipbill.billtype ='Send it to consumed'
then
a_value_chosen :=Show_Lov('RG_CONSUMED');
end if;
end if;
end if;
END;
END; -
Dynamically change LOV in oracle apps forms
Hi,
I have one requirement the Item LOV need to change based on the condition. If the condition is X then it use the X record group and attach to the LOV (This record groups is I have already created at design time). I can able to attache the record group to the LOV based on condition but if I click the LOV it not pop up in a window it is simply not working (no error).
If I enter some text in the Item and press Tab then the LOV window is pop up.
Can you please post your suggestion or solutions for this issue.
I am giving my sample code the below code I am using to attache the record group to the LOV.
Item level KEY-LISTVAL Trigger
Set_ITEM_Property('XXRULES.P_RULE_VALUE',LOV_NAME,'ZIP_CODE');
Set_ITEM_Property('XXRULES.P_RULE_VALUE',LOV_VALIDATION,PROPERTY_TRUE);
Set_LOV_Property('ZIP_CODE',GROUP_NAME,'ZIP_CODE');Set_ITEM_Property('XXRULES.P_RULE_VALUE',LOV_NAME,'ZIP_CODE');Set_ITEM_Property('XXRULES.P_RULE_VALUE',LOV_VALIDATION,PROPERTY_TRUE);
Set_LOV_Property('ZIP_CODE',GROUP_NAME,'ZIP_CODE'); Is this all of your code? If so, you are missing the call to Show_LOV(). Remember, Show_LOV() returns a boolean so you have to catch the return value.
DECLARE
b_selected BOOLEAN := FALSE;
BEGIN
Set_ITEM_Property('XXRULES.P_RULE_VALUE',LOV_NAME,'ZIP_CODE');
Set_ITEM_Property('XXRULES.P_RULE_VALUE',LOV_VALIDATION,PROPERTY_TRUE);
Set_LOV_Property('ZIP_CODE',GROUP_NAME,'ZIP_CODE');
b_selected := Show_LOV('ZIP_CODE');
END;Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly.
Maybe you are looking for
-
iCal was working fine before upgrading to v. 5.0.1 on my iPad. All the events from my iCloud account have disappeared and I cannot find a way to add a new event. No "+" sign, tapping doesn't work. I've tried everything I can think of. Any suggestion
-
My firefox will not load, ive tried clicking the task bar icon and the icon in program files x86 but it will not load. When I tried to uninstalland reinstall it told me that I had to close firefox first so apparently it is running. In proccesses ther
-
Ipod says no music but when connected to computer shows music
ipod says no music, but when hooked to mac shows music and playlists
-
Plugins are block need to update can't play games on facebook
Tried to down load adobe plugings but was enable to do so,was blocked from doing so.I also was told that java needed to be updated,I had no sucess.Mozilla says plugins are outdated,needed upgrading.Can you help me?
-
When you create a portrait view app in Siena with a camera control, the image is rotated as is the application was in landscape. Is there now, or will there be in the future, a way to rotate the control so it displays properly? Thanks. Please remem