(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

Similar Messages

  • 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 Uppal

    I 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.

  • 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
    s

    Dear,
    May be you don't set LOV's "Column Mapping Properties". After setting the properties correctly you will be able to display LOV.
    Thanks.

  • Record groups and LOV

    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

  • Dynamic record group

    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 PM

    hi
    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

  • Dynamic record group not working when apostrophes are used

    Hi Everyone,
    I have developed a Form for the most part everything is working as expected. However, there is a search functionality that is giving me problems. The issue is that when the user enters search criteria for last_name that has an apostrophe (O'brian) the search lov doesn't get populated because the dynamic record group is not getting created when the string has an apostrophe (ie O'brian). I have a dynamic record group that takes the user's search criteria and populates an LOV on the screen with the records that matched their criteria.
    Here is the code that is behind my search button where the dynamic RG gets created. It works fine for all searches that don't contain an apostrophe. Btw, the Oracle Forms version is 10g.
    DECLARE
    p_where_debtor varchar2(2000);
    p_where_liab varchar2(2000);
    rg_id RecordGroup;
    v_query varchar2(2000) := null;
    rg_name varchar2(2000):= 'RG_LIAB_LST';
    errcode NUMBER;
    BEGIN
    IF :SEARCH.cd_nb is null and
    :SEARCH.cd_seq is null and
    :SEARCH.f_name is null and
    :SEARCH.l_name is null and
    :SEARCH.mi_name is null
    then
    display_message ('Search criteria must be entered');
    raise form_trigger_failure;
    END IF;
    v_query := 'SELECT last_name, first_name, middle_name, c_no, c_seq
    FROM TABLE_VW2 WHERE 1=1';
    /*Search criteria entered by user*/
    IF :SEARCH.l_name_srch IS NOT NULL THEN
    v_query := v_query||' AND UPPER(last_name) LIKE '''||UPPER(:SEARCH.l_name)||'%''';
    END IF;
    IF :SEARCH.f_name_srch IS NOT NULL THEN
    v_query := v_query||' AND UPPER(first_name) LIKE '''||UPPER(:SEARCH.f_name)||'%''';
    END IF;
    IF :SEARCH.mi_srch IS NOT NULL THEN
    v_query := v_query||' AND UPPER(middle_name) LIKE '''||UPPER(:SEARCH.mi_name)||'%''';
    END IF;
    IF :SEARCH.cdcs_nbr_srch IS NOT NULL THEN
    v_query := v_query||' AND UPPER(c_no) LIKE '''||UPPER(:SEARCH.cd_nb)||'%''';
    END IF;
    IF :SEARCH.cdcs_seq_srch IS NOT NULL THEN
    v_query := v_query||' AND UPPER(c_seq) LIKE '''||UPPER(:SEARCH.cd_seq)||'%''';
    END IF;
    /*Make sure record group doesn't exisit*/
    rg_id := Find_Group(rg_name);
    /*If it doesn't exist then create record group*/
    IF id_null(rg_id) THEN
    rg_id:= create_group_from_query(rg_name,v_query);
    END IF;
    IF NOT id_null (rg_id) THEN
    delete_group (rg_id);
    rg_id:= create_group_from_query(rg_name, v_query);
    END IF;
    errcode := Populate_Group(rg_id);
    Any help would be greatly appreciated.
    Thanks,
    Adrian

    For every item where an apostroph can occur, do a
    REPLACE(:BLOCK.ITEM, '''', '''''');

  • Record Group and From-Clause Datasource

    I need to do several complex queries (read-only) for my form. Original I used From-Clause datasource but, as the requirement changed, there are some limitations. I would rather no do anything dynamically if as all possible because there are over 20 such queries which makes the code difficult to maintain. I wanted to be able to reference block items in the query.
    I'm thinking about using Record Group query instead. What are the differences in capability between Record Groups and From-Clause Datasource?
    Thanks.
    Clayton.

    Thanks.
    That's exactly the problem I have. I don't want to use LOVs so I've been thinking about how to visualize the record group data using data blocks. Perhaps I'll just go with dynamically building the From-Clause.
    I've looked into stored procedure based blocks a bit; it was confusing for me. Are the stored procedures stored in the database or are they defined in the form?

  • Dynamic view object and LOV

    Here's the problem I've encountered. I need to create an input LOV, where list is taken from dynamically created view object (it is created using createViewObjectFromQueryStmt; query may be different, but it always has 3 columns with fixed names - that's the rule). The problem is quite similar to that described here: {thread:id=935344}
    I've tried to create a "stub" LOV with a query like
    select 1 ID, 1 RESULTVALUE, 'dynamic' SNAME from dual(all the queries will have 3 columns with names ID, RESULTVALUE and SNAME) and then changing it's query by using something like this
        public void recreateDynamicViewObject(String newSQL) {
            ApplicationModule am = ADFUtils.getApplicationModuleForDataControl(DATACONTROL);               
            if (am.findViewObject(DYNAMIC_VO_NAME) != null)
                am.findViewObject(DYNAMIC_VO_NAME).remove();       
            ViewObject vo = am.createViewObjectFromQueryStmt(DYNAMIC_VO_NAME,newSQL);
            vo.executeQuery();               
        }but it didn't work (with the same results as it was mentioned in the post I've given reference to - the VO changes, but the new rows are not displayed).
    My question is almost the same: is it possible to use a dynamically created VO in LOV? The option of creating a VO for each query is unacceptable in my case, because these queries in fact are created by end users, and there can be any number of these queries.
    In case it is important - I use JDeveloper 11.1.1.2.0.

    I am also looking for a similar solution.
    Actually it works partially.
    I have a created a permanent View Object with a dummy query and in the run time I am replacing the View Object query in the ProcessRequest in CO.
    My problem is when you click on the LOV it works fine with the changed query results, but when I clicked again on the LOV, it shows the the dummy query results which I gave it in the VO.
    Here is my AM method which is called in the CO.
    BOSS_Parameter1_LOV_VOImpl parameterVO =
    getBOSS_Parameter1_LOV_VO1();
    parameterVO.clearCache();
    parameterVO.executeQuery();
    System.out.println(parameterVO.getQuery());
    parameterVO.setWhereClause(null);
    parameterVO.setWhereClauseParams(null);
    parameterVO.setQuery(lovQuery); // this the dynamic query
    parameterVO.setWhereClause(null);
    System.out.println(parameterVO.getQuery());
    Even though its showing the changed query in the getQuery, the LOV is not refreshed.
    I am also changing the Query of the View Object in the ProcessFormRequest
    if (pageContext.isLovEvent() || pageContext.getParameter(EVENT_PARAM).equals("lovPrepare")) {
    call the above mentioned method in the AM.
    But, still it doesn't work.
    Any tips will be appreciated.
    Thanks,

  • Very Urgent Extn.Material Group and Material Group.

    Hi Guru's,
          I was created Generic D.S Using table (AFRU) for Orders Confirmation.I was Created Info Source AND ODS.
         I nedd to maitain ODS Extn.Material Group and Material Group.but These fields are not Avilable in Data Source (AFRU Table not having).
        Data source having Field AUFNR (order number) I was mapped To BW Object 0prodorder. I was maitained master data for 0prodorder.
      0prodorder master data (0prodorder_attr) having 0material (PLNBEZ Field mapeed to 0material) as a navigational Attribute.
    i am asking to all is it possible to bring Extn.Material Group and Material Group update rule level using master data attribute option?
    Please help to me Above issue.it's very urgent.
    Thanks & Regards,
    Guna.

    Hi Manju & Gopi,
        This Order Confirmations cube having data from 2 data sources.
        There is a performence issue to clubbing so many tables.
         Any way i was maitained 0material is attribute(Nav Attr) of 0proorder.i was loaded 0prodoreder master data.
       0material having master data .Extn mat group & Material group are Nav Attributes of 0material.
      Now is it possible to maitaining the data in cube Extn mat group & Material group ?
    Please Give me Suggestion with out adding another table using view.
    Thanks & Regards,
    Guna.

  • Recording, grouping and playing an action...I am stumped!

    First I will start by mentioning  I am working with CS6. Recently I have  been recording a few actions that I like to run on a lot of my photos. Before I am done recording these actions I like to group them. Here is where the problem comes into play however...First time I play the action it shows up perfectly in the layer  panel. The 2nd,3rd attempt an  so on, the action that  is grouped (the same action or another grouped action) will show up all jumbled in the layers panel. Sometimes the adjustment layers show up outside of the group while others the group appears to have "eaten" the first group of actions I ran. Am I missing something why cant  I stack the actions I have written?

    glissonamanda wrote:
    Before I am done recording these actions I like to group them.
    Why are you trying to record steps like moving actions to group them and such.  You should stop recording the actions.  Then move, group and organize them the way you want. After that you should save all the action set you messed with so you don't loose the new actions you recorded and have save them organized and grouped the way you want.  If you record steps the move and copy actions mess with actions when you play the action these steps are recorded in the action will more then likely mess up actions and the grouping you did.
    Post a screen capture of the action steps of the action your having a problem with. Have you looked at waht is recorded in the action?

  • Dynamic Record Group problem

    I am trying to assign LOV to a field on 6i form programatically. Here is the procedure I created.
    PROCEDURE XXSAG_RECGROUP IS
    XXSAG_ACCOUNT_RG               RECORDGROUP;
    val                                   number;
    val_chosen               boolean;
    raise_error               exception;
    BEGIN
    if (id_null(XXSAG_ACCOUNT_RG)) then
    XXSAG_ACCOUNT_RG := Create_Group_From_Query('ACCOUNT_NUMBER','select account_number'||' from xxsag_prod_producer_info'
                   ||' where production_id = :xxsag_prod_main.production_id'
                   ||' and account_type = :xxsag_prod_producer_info.account_type ');
                   val := Populate_Group(XXSAG_ACCOUNT_RG);
                   If val != 0 then
                        delete_group(XXSAG_ACCOUNT_RG);
                        raise raise_error;
                   End If;     
                   set_lov_property('ACCOUNT_NUMBER_LIKE',GROUP_NAME,'XXSAG_ACCOUNT_RG');
                   set_item_property('XXSAG_PROD_PRODUCER_INFO.ACCOUNT_NUMBER',LOV_NAME,'ACCOUNT_NUMBER_LIKE');
                   delete_group(XXSAG_ACCOUNT_RG);
              end if;     
    END;     
    However, when the cursor goes to the field, I see the LOV toolbar but no records show up. Please help.
    Thanks.

    Please explain why you need to create the group during run-time. I don't see anything in your code that might require this.
    Are you just trying to change the contents of the LOV based on the values in production_id and account_type? I think setting Automatic Refresh to YES might do it.

  • How to write WHERE clause in dynamic record group in oracle forms

    hi this is s.v.eswar,PLZ HELP ME
    i am new to oracle forms
    i want to write where clause in dynamic recordgroup
    this is the code i have written
    DECLARE
         MGR_ITEM ITEM:=FIND_ITEM('MGR');
         RG_ID_MGR RECORDGROUP:=NULL;
         MGR_DUMMY NUMBER;
    BEGIN
         RG_ID_MGR:=FIND_GROUP('MGRNUMBER');
         IF ID_NULL(RG_ID_MGR) THEN
              RG_ID_MGR:=CREATE_GROUP_FROM_QUERY('MGRNUMBER','SELECT DISTINCT TO_CHAR(EMPNO),TO_CHAR(EMPNO) FROM EMP WHERE JOB='MANAGER''); --THIS IS THE LINE I AM GETTING ERROR
         END IF;
         IF NOT ID_NULL(RG_ID_MGR) THEN
              MGR_DUMMY:=POPULATE_GROUP('MGRNUMBER');
              IF MGR_DUMMY=0 THEN
                   POPULATE_LIST(MGR_ITEM,'MGRNUMBER');
              END IF;          
         END IF;     
    END;
    COMPILE TIME ERROR
    1)I have written where clause like this WHERE JOB='MANAGER'
    then oracle compiler has given error like
    ENCOUNTERED THE SYMBOL 'MANAGER' WHEN EXPECTING ONE OF THE FOLLOWING .,().........etc
    (FOR THE ABOVE ERROR I JUST REMOVED SINGLE CODES AND WRITE LIKE THIS ----->WHERE JOB=MANAHER)------>THEN COMPILED SUCESSFULLY)
    AND I RUN THE FORM
    RUN TIME ERROR
    FRM-41072: CAN NOT CREATE GROUP 'MGRNUMBER'

    Hi there
    pls have a look here
    Dependent drop down lists in forms 6i
    hope this helps...
    regards,
    Amatu Allah

  • URGENT!!reports and lovs

    Oracle Portal Report
    I created an Lov named "tabb" to list the tables from a remote database. it works fine.
    i want to list the fields available in each table using the LOV. i used reports from SQL Query. i used the following query;owns is the dblink name.
    select owner,table_name,column_name,data_type,data_length,data_precision from all_tab_columns@owns where table_name=upper(:tabb)
    i get no output.the same query with a local database works fine

    hi,
    i created a public database link only.
    my LOV is built using the query select * from tab@owns
    SQLQuery Report is built using the query
    select owner,table_name,column_name,data_type,data_length,data_precision from all_tab_columns@owns where table_name=upper(:tabb)
    the ouput is "no Rows Returned" for whatever table i select from the LOV when i run.

  • Dynamic creation of record group

    Hi
    Can anyone suggest me with an example about how to create a dynamic record group and attach it to a lov ?
    Regards

    Hi,
    Thanks for your reply
    DECLARE
    rg_name VARCHAR2(40) := 'COMPANY_RANGE';
    rg_id RecordGroup;
    errcode NUMBER;
    lov_id LOV;
    BEGIN
    :System.Message_Level := 0;
    rg_id := Find_Group( rg_name );
    IF Id_Null(rg_id) THEN
    rg_id := Create_Group_From_Query( rg_name||'_TMP', 'select COMPANIES_ID from SYSMODULE.COMPANIES where 1=2');
    Set_LOV_Property(lov_id,GROUP_NAME,rg_name||'_TMP');
    rg_id := Create_Group_From_Query( rg_name, 'select COMPANIES_ID from SYSMODULE.COMPANIES');
    IF Id_Null(rg_id) THEN
    Message(' Create group failed');
    Message(' ',no_acknowledge);
    Raise Form_trigger_failure;
    End if;
    END IF;
    errcode := Populate_Group( rg_id );
    lov_id := Find_LOV('LOV7');
    Set_LOV_Property(lov_id,GROUP_NAME,rg_name);
    END;
    The above code, I have placed in when new form instance .. still the same error
    when new block instance --- same error
    in push button --- same error
    FRM-30048: Unable to find record group .
    LOV LOV7
    Form: DYNAMIC_LOV_CREATION
    FRM-30085: Unable to adjust form for output.
    Where i am going wrong ..
    Regards

  • URGENT : Record Group Problem

    hello all
    i have a problem regarding record group.
    i want to populate my record group with a dynamic clause which is
    "and main_code not in ('02725','02868')"
    and my record group query is
    "select mt.main_number from main_table mt,main_parent mp
    where mt.main_code = mp.main_code
    and mt.main_code not in (:parameter.param_main_code)"
    now i am adopting the following method for populating the
    LOV(list of values) which is attached to a text item:
    assigning values i.e. '02725','02868' to my parameter object i.e. :parameter.param_main_code but the record group is not giving changd results according to my criteria i.e.'02725','02868'...
    does any body knows the solution for this problem..kindly help him with it..logically the record group query should work and return a changed results for the LOV..
    please help me with this.....
    thank you.

    I thing you can't able to do what you are trying to do, but you can achive this by using dynamic record group.
    Create the dynamic record as same struncture of design time then populate it by the coding.
    Sample Code is
    declare
         l_rec_name RecordGroup;
         l_rec_col GroupColumn;
         l_rec_col1 GroupColumn;     
         cursor l_ename is select ename from emp;
         l_row number(12):= 1;
    begin
         l_rec_name := create_group('rg_dynamic',Form_scope, 100);
         l_rec_col := add_group_column(l_rec_name,'ENAME',char_column,30);
         l_rec_col1 := add_group_column(l_rec_name,'EMPNO',number_column,6);     
         for i in l_ename
         loop
              add_group_row(l_rec_name, end_of_group);
    set_group_char_cell(l_rec_col,l_row, i.ename);
    set_group_number_cell(l_rec_col1,l_row, l_row);
    l_row := l_row+1;
         end loop;
         :parameter.num_rows := l_row -1;
         set_lov_property('LOV5',group_name,'RG_DYNAMIC');
    end;
    I hope this will help you to solve this problem.
    [email protected]

Maybe you are looking for