Home » Developer & Programmer » Forms » Dynamic LOV !! Forms Guru's Please Help
Dynamic LOV !! Forms Guru's Please Help [message #146848] Mon, 14 November 2005 03:52 Go to next message
Nitin T
Messages: 7
Registered: February 2002
Junior Member
Hi,
I am not sure if anyone has any answers for tthis but still hopeful one of the formd guru will respond Smile

Requirement is to attach a record group to an existing LOV at runtime (Code attached below)

Using TEMPLATE.fmb
Forms Version 6.0.8.24.1

What I have tried....

Step1: Created a Dummy record group 'BRDIGE_GROUP' type Query with query
'select 'AMIT' COLUMN1, 'NITIN' COLUMN2, 'DEBI' COLUMN3, 'VISSU' COLUMN4 FROM DUAL'

Step2: Created a LOV 'BRIDGE_LOV' attacehd above record group BRDIGE_GROUP' to it , assigned all four recrd grp columns to LOV thru LOV wizard, Column1 assigned to return value to one of the text items in Data Block 'XXAP_MAPPING_VALUES.BRIDGE_CODE'

Step3. Ran the form .. worksfine with LOV displayed with foulr columns with above four values.

Step4. Create a PRE-BLOCK Trigger for block 'XXAP_MAPPING_VALUES' to create a record group 'VENDOR' at runtime and assign it to existing LOV 'BRIDGE_LOV' (See code below)

Step5. Ran form again evrythin works fine but when navigating to the item 'XXAP_MAPPING_VALUES.BRIDGE_CODE' the LOV does not pop up , though I can see using FND_MESSAGE.DEBUG that record grp has been assigned to the LOV, Recrd grp returns a non zero rowcount when populated , LOV has been assigned to the ITEM bit it does not display the POPUP window

Can some one point out what am I Missing here
Thanks
Nitin
-----
PRE-BLOCK Trigger Code -----
-----

declare
rg_name varchar(40) := 'VENDOR';
lv_name varchar(40) := 'BRIDGE_LOV';
rg_id RecordGroup;
gc_id GroupColumn;
--status number;
query_ok number;
curr_grp varchar(30);
rwcnt number;

begin

-- Make sure the record group does not exists already
rg_id := Find_Group(rg_name);

--IF Id_Null(rg_id) THEN
-- FND_MESSAGE.DEBUG('rg_id is null');
--END IF;

--DELETE_GROUP_ROW(rg_id, Get_Group_Row_Count(rg_id));

-- If record group does not exist then create the group
IF Id_Null(rg_id) THEN

rg_id := Create_Group(rg_name );

gc_id := Add_Group_Column(rg_id, 'COLUMN1',CHAR_COLUMN,15);
gc_id := Add_Group_Column(rg_id, 'COLUMN2',CHAR_COLUMN,15);
gc_id := Add_Group_Column(rg_id, 'COLUMN3', CHAR_COLUMN, 15);
gc_id := Add_Group_Column(rg_id, 'COLUMN4', CHAR_COLUMN,15);

query_ok := Populate_Group_With_Query(rg_id,
'select to_char(vs.vendor_site_id) COLUMN1, substr(vs.vendor_site_code,1,15) COLUMN2, substr(v.vendor_name,1,15) COLUMN3, substr(v.segment1,1,15) COLUMN4'
||' from po_vendors v, po_vendor_sites vs'
||' where vs.VENDOR_ID = v.VENDOR_ID'
||' order by 1');
/*
rg_id := Create_Group_From_Query(rg_name,
'select to_char(vs.vendor_site_id) id, substr(vs.vendor_site_code,1,15), substr(v.vendor_name,1,15), substr(v.segment1,1,15)
from po_vendors v, po_vendor_sites vs
where vs.VENDOR_ID = v.VENDOR_ID
order by 1');
*/
--FND_MESSAGE.DEBUG('created rec grp');

-- execute the new group's query
query_ok := Populate_Group(rg_id);
--FND_MESSAGE.DEBUG(query_ok);

rwcnt := Get_Group_Row_Count(rg_id);
--FND_MESSAGE.DEBUG(rwcnt);

-- if query failed abort this trigger by raining exception
IF query_ok <> 0 THEN
RAISE Form_Trigger_Failure;
END IF;
END IF;

-- attach record group to the lov
Set_LOV_Property(lv_name, GROUP_NAME, rg_name);
--FND_MESSAGE.DEBUG('rec grp attached');
--Set_LOV_Column_Property(lv_name, 1, TITLE, 'Site_Id');
--Set_LOV_Column_Property(lv_name, 1, WIDTH, '1');
--Set_LOV_Column_Property(lv_name, 2, TITLE, 'Site_Code');
--Set_LOV_Column_Property(lv_name, 2, WIDTH, '1');
--Set_LOV_Column_Property(lv_name, 3, TITLE, 'Vendor_Name');
--Set_LOV_Column_Property(lv_name, 3, WIDTH, '1');
--Set_LOV_Column_Property(lv_name, 4, TITLE, 'Vendor_Number');
--Set_LOV_Column_Property(lv_name, 4, WIDTH, '1');

curr_grp := Get_LOV_Property(lv_name, GROUP_NAME);
FND_MESSAGE.DEBUG(curr_grp);

-- attach lov to the item
APP_ITEM_PROPERTY.SET_PROPERTY('XXAP_MAPPING_VALUES.BRIDGE_CODE', LOV_NAME, lv_name);



end;



Re: Dynamic LOV !! Forms Guru's Please Help [message #146948 is a reply to message #146848] Mon, 14 November 2005 18:31 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Quote:

Requirement is to attach a record group to an existing LOV at runtime (Code attached below)
It is a requirement that you CREATE the record group at run time?

How about creating two record groups in the Forms Builder instead of just one as you have done and then assigning the second at run time? Saves having to write the delete_group / create_group code (by the way, you haven't tested that the group exists before creating it).

You say:
Quote:

when navigating to the item 'XXAP_MAPPING_VALUES.BRIDGE_CODE' the LOV does not pop up
Have you set the flag (Auto Display) on the LOV in the Form Builder to say that you want it to popup? '

David
Previous Topic: using number in list
Next Topic: Regarding WHEN_VALIDATE_ITEM TRIGGER
Goto Forum:
  


Current Time: Fri Sep 20 03:34:21 CDT 2024