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?

Similar Messages

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

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

  • Update statement that includes case, decode and from clause

    hello
    I've the following code. I ran this code in 9i and got the errror SQL command not properly ended. Can I use FROM clause in an update statement?
    CREATE OR REPLACE procedure NRI
    IS
    BEGIN
    UPDATE IEB2 SET SDI =
    (CASE PSDI WHEN '11' THEN '16'
    WHEN '13' THEN '38'
    WHEN '14' THEN '18'
    WHEN '23' THEN '21'
    WHEN '24' THEN '21'
    WHEN '31' THEN '27'
    WHEN '32' THEN '37'
    WHEN '33' THEN '38'
    WHEN '34' THEN '37'
    WHEN '43' THEN '46'
    WHEN '53' THEN '45'
    WHEN '55' THEN '48'
    WHEN '60' THEN '54'
    WHEN '61' THEN '57'
    WHEN '62' THEN '54'
    WHEN '63' THEN '56'
    WHEN '64' THEN '52'
    WHEN '70' THEN '21'
    WHEN '77' THEN '25'
    WHEN '78' THEN '41'
    WHEN '80' THEN '79'
    WHEN '85' THEN '75'
    WHEN '87' THEN '73'
    WHEN '15' THEN '15'
    WHEN '51' THEN '51'
    WHEN '88' THEN '88'
    WHEN '00' THEN '00'
    WHEN '99' THEN '99'
    WHEN '12' THEN DECODE(C.R_ID, 'N', '16','18')
    ELSE 'NONE' END)
    FROM D1.C C
    WHERE EXISTS
    (SELECT 1
    FROM D1.SD A, D2.SDP B, D1.C C
    WHERE A.SDN = B.DN
    AND B.SDI = '000000'
    AND B.PFI = 'W'
    AND B.CID = C.CID
    AND A.SDN = '0001500721');
    END;

    Your parenthesis look a tad messed up ... think this fixes them.
    CREATE OR REPLACE procedure NRI
    IS
    BEGIN
    UPDATE IEB2 SET SDI =
    SELECT
    CASE PSDI
      WHEN '11' THEN '16'
      WHEN '13' THEN '38'
      WHEN '14' THEN '18'
      WHEN '23' THEN '21'
      WHEN '24' THEN '21'
      WHEN '31' THEN '27'
      WHEN '32' THEN '37'
      WHEN '33' THEN '38'
      WHEN '34' THEN '37'
      WHEN '43' THEN '46'
      WHEN '53' THEN '45'
      WHEN '55' THEN '48'
      WHEN '60' THEN '54'
      WHEN '61' THEN '57'
      WHEN '62' THEN '54'
      WHEN '63' THEN '56'
      WHEN '64' THEN '52'
      WHEN '70' THEN '21'
      WHEN '77' THEN '25'
      WHEN '78' THEN '41'
      WHEN '80' THEN '79'
      WHEN '85' THEN '75'
      WHEN '87' THEN '73'
      WHEN '15' THEN '15'
      WHEN '51' THEN '51'
      WHEN '88' THEN '88'
      WHEN '00' THEN '00'
      WHEN '99' THEN '99'
      WHEN '12' THEN DECODE(C.R_ID, 'N', '16','18')
      ELSE 'NONE'
    END
    FROM D1.C C
    WHERE EXISTS 
        SELECT 1
        FROM D1.SD A, D2.SDP B, D1.C C
        WHERE A.SDN = B.DN
        AND B.SDI = '000000'
        AND B.PFI = 'W'
        AND B.CID = C.CID
        AND A.SDN = '0001500721'
    END;

  • KEY-EXEQRY trigger and FROM CLAUSE QUERY problem

    Hi,
    I have a form designed in Oracle Forms6i. I have two block on it, BlockA and BlockB.
    When BlockA is queried with some data to search, I need to build the FROM CLAUSE QUERY for BlockB. It uses the same WHERE condition as I used to search BlockA.
    I am building the FROM CLAUSE QUERY and executing query for BlockB on KEY-EXEQRY trigger of BlockA.
    It works fine, if first time, I query the BlockA without any specific data. But it gives me error 'ORA-01008: not all variables bound' if I query the BlockA with specific data very first time.
    Please advise.
    Thanx
    Zaaf

    No, I am not using any substitution variables. To get the LAST_QUERY for BlockA, I am using Get_Block_Property.
    But now I switched it to :system.LAST_QUERY and it worked.
    Thank you!

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

  • CBO and FROM clause

    hi,
    is the concept of ordering of tables in FROM clause still valid for CBO.
    I mean the concept of oracle selecting the driving table based on the positions of table in FROM clause still valid??
    If yes, then how should the tables be placed? the one with least rows in the end of from clause??
    Also is it better to leave to CBO or put a /*+ORDER */ hint??because additional time will be wasted by CBO in collecting stats??
    Any authentic document which speaks about optimization techniques??( i mean SQL tuning rules)
    s
    Message was edited by:
    user571638

    When I started, my focus was also on SQL tuning rules but I found out that this was not the most efficient way to tune performance. You can save a lot of time on performance tuning when you let the CBO work for you:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211/toc.htm

  • URGENT,FRM-41337: Cannot populat the list from record group

    Hi all:
    Can anyone help me in that problem?
    I have a database item in the block as a list item with combo box style and I use this code in WHEN-NEW-RECORD-INSTANCE at the form module level to populate that combo box list:
    DECLARE
         group_id RECORDGROUP := FIND_GROUP('group');
         list_id ITEM := FIND_ITEM('employees.job_id');
         x number;
    BEGIN
    IF NOT ID_NULL (group_id) THEN
              DELETE_GROUP (group_id);
         END IF;
              group_id := CREATE_GROUP_FROM_QUERY ('group','select name,TO_CHAR(id) job from cmn_jobs where job_type_id = 4720 ');
         x := POPULATE_GROUP (group_id);
         POPULATE_LIST (list_id, group_id);
         EXCEPTION
    WHEN NO_DATA_FOUND THEN
    null;
         END;
    That code worked very well and without any problem, but when I change the list item from combo box style to poplist style then the forms give that error:
    FRM-41337: Cannot populat the list from record group
    And an additional null/blanke element appears in the poplist with original element that come from RECORDGROUP.
    So can anyone help me to solve that problem please?

    First, how I can assign a default or initial value DYNAMICALLY to my poplist.Set the default-value to a parameter like :PARAMETER.MYPARAMETER then you can assign the desired default-value to the parameter.
    second, if I have popliste say X for example depend on another poplist say Y ,so when I put the code to populate popliste X on WHEN-LIST-CHANGED on popliste Y and make query then the >forms return FRM-40301 Query caused no records to be retrieved ,but when I have a copy for that code in WHEN-LIST-CHANGED and put it in WHEN-NEW-FORM-INSTANCE at the form >module the form work and returns records, so is it any error or exception in what I did.Can't answer that, you should check :SYSTEM.LAST_QUERY to see why the query does not returnany records.
    At the last, which better to put the code for popliste in PRE-FORM trigger at the form module or in WHEN-NEW-FORM-INSTANCE at the form module.I would use the PRE-FORM-trigger

  • SQL Select and From Functions

    Can sql aggregate functions be added to an interface select clause and from clause.
    I want to have a datasource where one of the columns is an aggregate such as a count, which would need the ability to indicate a from clause function group by, or having by. In the Designer Diagram tab for the interface, it seems you can only apply sql functions to where clause joins or filters.
    I want to have a query such as follows as my datasource
    select columnA, count(*) as thecount
    from table x
    group by columnA
    order by thecount asc
    and ultimately
    select columnA, thecount
    from (select columnA, count(*) as thecount
    from table x
    group by columnA
    order by thecount asc)
    where rownum <1001
    Can this be done in the ODI Designer, without creating a physical custom view on the database?

    Hi lpantuso,
    Aggregate functions are added by ODI automatically. In this case you would want mappings like this:
    TARGET_COL_1: columnA
    TARGET_COL_2: count(*)
    ODI will generate something like this:
    select     
       columnA,
       count(*)
    from     MY_TABLE MY_TABLE
    where     
         (1=1)
    Group By MY_TABLE.columnA
    The subselect, however, isn't handled out of the box. In general ODI isn't quite as friendly with ordering clauses since order by is not relational. (Sets aren't ordered.) To get only the first 1000 columnA values, you'll probably need to create a view or break it into 2 separate interfaces.
    Regards,
    Matt

  • FROM Clause query data source type

    i do i get the result set of a FROM Clause datasource into an item.

    A FROM clause may be used as the datasource for a data block. A FROM clause is a feature of the Oracle8 Server that allows you to nest a SELECT statement in the FROM clause of a SELECT statement. A FROM clause is a valid query block datasource, but it is not a valid DML block datasource. The value returned from a FROM clause is a subset of records from the original query.
    FROM clauses are used to perform joins, lookups, and calculations without having to create a view on the server. FROM clauses can also be used to prototype views and to increase performance.
    Using a FROM clause as a block datasource is similar to using an updateable join-view as a block datasource. However, a FROM clause provides more control, because the presence of a DBA is not required to define the view. You should note that the FROM clause produces results that are identical to an updateable join-view from the client side, but that there is no defined view on the server.
    My question has not been answere and i hope the above copies explanation from forms6i documentation will help understand the question better.
    Please Advise

  • 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

  • Dynamically creating a Record Group based on Previously entered Record Grou

    Forms [32 Bit] Version 10.1.2.3.0 (Production)
    Hi,
    I know how to dynamically create a record group based on a query and putting the code in When new form instance.
    My query is. I have a form which has multiple Record Groups and the user wants to dynamically create subsequent groups based on previous groups.
    For example
    I have a record group with selects a Location,
    when the user selects the Location from a list of values
    the 2nd record group called 'Cost Centres' will have to filter out only those with the locations selected above.
    How can I populate the 2nd record group at run-time when I do not know what site the user will select?
    If I simply populate in when new form instance as in location and just select everything, the list of values populates.
    CC field is a LIST ITEM and the list style is a POP LIST, it is not required.
    I have put the code in the Location field in the when-list-changed trigger.
    I am getting this error:
    frm-41337: cannot populate the list from the record group
    here is the code:
    DECLARE
    v_recsql Varchar2(1000); -- The SQL for creating the Record Group.
    v_recgrp RecordGroup; -- Record Group
    v_status Number; -- Return Value of Populate_Group function.
    c_where VARCHAR2(1000);
    BEGIN
         IF :location = '1' THEN
              c_where := ' substr(cost_centre,1,2) in (''01'',''02'')';
         ELSIF :location  = '2' THEN
              c_where := ' substr(cost_centre,1,2) in (''02'',''03'')';
         ELSIF :location   = '3' THEN
              c_where := ' substr(cost_centre,1,2) in (''01'',''11'',''07'')';
                   ELSE
              c_where :=  ' 1=1'; --EVERYTHING
         END IF;
    v_recsql := 'SELECT cost_centre, description  FROM   cost_centres  where '||c_where;
    -- Create the Record Group
    v_recgrp := CREATE_GROUP_FROM_QUERY('v_recgrp', v_recsql);
    IF NOT ID_NULL(v_recgrp)
    THEN -- No Error, record group has been successfully created.
    -- Populate Record Group
    v_status := POPULATE_GROUP('v_recgrp');
    IF v_status = 0
    THEN -- No Error. Record Group has been Populated.
    POPULATE_LIST('block.CC', 'v_recgrp');
    END IF; -- IF v_status = 0
    -- Delete the Record Group as it is no longer needed.
    DELETE_GROUP('v_recgrp');
    END IF; -- IF NOT ID_NULL(v_recgrp)
    END;thanks for your assistance.

    Hi,
    Once record status gets change for block you can not populate/repopulate the list item. Keep those list items as non-database item with different names and create different items as database orignal items. Than assign the values in WHEN-LIST-CHANGE trigger to the actual database items.
    -Ammad

  • What are record groups for?

    hi,
    Could anybody tell me what is the main purpose of creating record groups whith statements like: create_group_from_query, populate_group, ...
    Every time we want to access any records we can use blocks which are based on tables or views which are in Oracle Data Base. So what is the reason of creating record groups?
    please explain my that issue:)
    Grzegorz

    hi grzegorz,
    Record Group is one which is used with LOVs and List Items.
    for the use of LOV & List items u must have to define record group through whis the List items or LOV is belogs to that group.
    A record group built from a query can store records from database tables much like a database view, with the added advantage that the record group is local to Form Builder, rather than existing in the database.
    To know more about record group, form builder's help is good way,
    Regards
    Chandan

Maybe you are looking for

  • Keynote 6.1 won't open file created in 6.0

    I erased my hard disk, and installed the latest version of keynote (6.1). I downloaded a keynote file from dropbox that I had create with version 6.0 (or 6.01, I can't remember). When I try to open the file, it says I need the latest version of keyno

  • How to save a pdf so you can edit in reader

    I have a PDF save in Acrobat Pro. How do I save it so a person with just Acrobat Reader can edit it?

  • Just upgraded to 2.0 software, having issues with apps and fetching

    what is fetching? it is set to manual fetching right now? what does that do and how do i fetch? also, i downloaded 9 free apps, and iTunes said it couldnt sync them to my ipod because i don't have privelages for them on my computer. can anyone help m

  • A help on triggers

    Hi all, I have a doubt with triggers. my synario is, I have to make 2 insets and a select(one after the other continuously). One of the two insert statements will fire a Trigger(AFTER INSERT Trigger) and do some manipulations on data.After this I use

  • How to convert iDVD theme to .mov file. for use in FCP?

    I would like to use the Baby Mobile iDVD theme as a clip in a movie to be created on FCP. I dropped my pics in the iDVD project with the Baby Mobile theme and put in a green background so I could later key out the background and replace it with a dif