Dynamically Change Record Group in Form

From SQL Query

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;


From Existing Record Groups

Take serial number behavior as example,For different Txn Type,Then serial number LOV will dispaly different values,so we need to bind different record groups.
Sample Code like:
File:INVSLENT.pld       

         PROCEDURE set_rec_group (
         ... ...
         IF (trx_act = 1)
         THEN
            SET_LOV_PROPERTY (llov_name, group_name, 'inv_serial1');
            SET_LOV_PROPERTY (to_serial_lov_name, group_name, 'inv_serial1');
         ELSIF (trx_act = 2)
         THEN
            SET_LOV_PROPERTY (llov_name, group_name, 'inv_serial2');
            SET_LOV_PROPERTY (to_serial_lov_name, group_name, 'inv_serial2');
         ELSIF (trx_act = 3)
         THEN
            SET_LOV_PROPERTY (llov_name, group_name, 'inv_serial3');
            SET_LOV_PROPERTY (to_serial_lov_name, group_name, 'inv_serial3');
         ELSIF (trx_act = 4)
         THEN
            SET_LOV_PROPERTY (llov_name, group_name, 'inv_serial4');
            SET_LOV_PROPERTY (to_serial_lov_name, group_name, 'inv_serial4');
         ELSIF (trx_act = 5)
         THEN
            SET_LOV_PROPERTY (llov_name, group_name, 'inv_serial5');
            SET_LOV_PROPERTY (to_serial_lov_name, group_name, 'inv_serial5');
         ......





你可能感兴趣的:(Dynamically Change Record Group in Form)