Clearing VO dynamic Query-By-Example ViewCriteria

Looking for some help with JDev 11.1.1.4.0, ADF BC + ADF Faces RC please.
At it's simplest we're looking how to clear the query-by-example (QBE) filters on a VO without using the table UI component and not accidentally clearing other view criteria on the VO. To explain our use case first let me define the characteristics of our app. We have:
a) A BTF based on fragments:
a.1) The transaction/data control scope = Use Existing Transaction if Possible/Shared
a.2) It contains a single fragment
a.3) The fragment contains a table based on an ADF BC View Object (VO)
a.4) The VO has a view criteria defined at design time, implemented via the Application Module (AM)
a.5) The table allows the user to filter the data
a.6) The BTF does not include any task flow returns or parent actions
b) A consuming BTF based on pages:
b.1) The transaction/data control scope = Always Begin New Transaction/Isolated
b.2) It contains 2 pages with navigation rules to move between them (back/forward)
b.3) The fragment from "a" is included on both pages in "b"
b.4) When navigation occurs between the pages, it is invoked via buttons in this BTF, not the original BTF via parent actions or task flow returns. This aligns with point a.6. As such when navigations occurs between the 2 pages, the region/task flow binding instance of "a" in the region of the current page of "b" is prematurely terminated. The implication is the instance of "a" doesn't get a chance to do any processing before it is closed.
Note that "a" and "b" are built in isolation of each other. "b" has no inherit knowledge about the components of "a" nor the ADF BC components. The implication is "b" cannot attempt to grab the table UI component, nor manipulate the ADF BC components as it doesn't know anything about the BTFs dropped on its pages.
If the user opens the 1st page in "b" and enters a query-by-example criteria on the table from the region containing the 1st of instance of "a", then the user navigates to the 2nd page, the filter criteria are still set on the 2nd instance of "a". This is expected behaviour as "a" has data control scope = shared implying when the QBE criteria are set on page 1, they are written down to the VO, which when the user navigates to page 2, as it is sharing the same VO the QBE criteria are there to reuse/share on page 2.
In our scenario what we want to do:
1) Is in navigating between the 2 pages, we wish the query-by-example filter criteria to be cleared/reset, such that navigating between pages the filter criteria are empty/fresh
2) However in navigating between the pages we must not lose the design time view criteria (and it's bind variable value) that has already been applied
3) Maintain shared data control scope so we minimize the amount of database connections
The common solution to clearing the QBE filter is as per Timo Hahn's following blog entry: http://tompeez.wordpress.com/2011/10/29/jdev-how-to-reset-a-filter-on-an-aftable/
Yet that solution assumes the code has access to the table UI component. As we need the QBE criteria reset on navigation caused by "b", and such navigation causes a premature termination of "a" there's no chance for "a" to grab the table component and clear the filter criteria before "b" navigates away. The logical solution to this is on entering "a" again, to programatically reset the QBE criteria as part of the initial steps in the "a" BTF. But on entering "a" using Timo's solution, the method call doesn't have access to table UI component as the fragment isn't yet rendered, making this solution not viable.
Another solution we've tried is calling applyViewCriteria(null) then reapplying our view criteria from a VO client interface method, but it appears we aren't clearing the QBE criteria. This worries me a bit because it looks like you can't discern the QBE view criteria from the normal view criteria unless you go through the table UI component methods.
So how do we clear the QBE filter criteria programatically, without clearing (or at least restoring) the design time view criteria, and without relying on the table UI component to clear the QBE criteria?
Phew, I hope that makes sense? Thanks for your help in advance.
CM.
PS. There is an assumption in the title of my post that table Query By Example criteria are stored as ADF BC View Object view criteria. Possibly it's a separate mechanism so please be careful this doesn't lead you astray in answering my post.

Chris,
I don't have time to follow this through right now, but I'm on to something.
I was able to affect the filter via the binding container (at least it's not the UI). See this code:
  public void a(ActionEvent e)
   String s = "#{bindings.EmployeesView1Query.queryDescriptor}";
   Object o = JSFUtils.resolveExpression(s);
   FilterableQueryDescriptor f = (FilterableQueryDescriptor) o;
   f.removeCriterion(f.getCurrentCriterion());
  }Now, it doesn't do exactly what you want (it actually somehow makes no rows show up in the table), but I believe it's moving in the right direction.
Am leaving for the office (5:40 am), so I'll pass this over to you to have a gander.
John

Similar Messages

  • Query By Example getting recorded, How to clear it ?

    Hi
    Say i have a page A, It has a table , I did a Query By example here.
    Then i navigate to another page, say B (from A ) and then if i come back to page A (not through Back Button ) , I still see the results modified by the Query By Example i did in last step.
    How to clear the previous query by example ? ?
    Thanks in advance
    Sajith

    Clearing Filter criteria in ADF Rich Table
    In ADF table, filter criteria is stored in filter model. So to clear filter, first get filter model then filter criteria and clear it. Many times you may need to queue event so that filter listener method is called.   At end you may need to refresh table to reflect this on UI.
    FilterableQueryDescriptor queryDescriptor = (FilterableQueryDescriptor)getTable().getFilterModel();
    if (queryDescriptor != null && queryDescriptor.getFilterCriteria() != null){
    queryDescriptor.getFilterCriteria().clear();
    getTable().queueEvent(new QueryEvent(getTable(),queryDescriptor));
    http://adfscopes.blogspot.com/2011/03/programatically-clearing-filter.html

  • Query by example - how can I display VCRow in JTable?

    I would like to provide the user with a searchable table.
    Actually I would like to use two tables: one, displaying one row where the user can specify the search criteria. And the second table should display the data found.
    I could store the entered criteria locally in a hashmap in TableModel, for example, then create a WHERE clause. This solution is quite messy, since the user can add, remove and rearrange the columns of both tables.
    Or I could use -I hope- the query-by-example feature, like this:
    am = app.getApplicationModule();
    ViewObject vo = am.createViewObject( "MyVO", "mypackage1.PatView" );
    ViewCriteria vc = vo.createViewCriteria();
    ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    Now I can set attributes and use vo.applyViewCriteria() to find my data.
    But how can I bring the first JTable to display this single ViewCriteriaRow, so that the user can do the editing?
    The JUNavigationBar does it, if I am not mistaken. It switches the PanelBinding to find mode, and then a JTable displays a ViewCriteriaRow (?) instead of the ViewObject's data. But I don't want to use the bar. How do I create this behaviour manually?
    The javadoc of JUPanelBinding says:
    "Sets this panel and all its associated iterators into find mode."
    So I guess that setting iterators into find mode is what I need. But I cannot figure out how to do that. Who can?

    You cannot set the iterators in a panelBinding to separate find/data modes individually.
    However you can create two JUPanelBinding objects one for the findMode form and one that displays Data.
    here's what I did to modify a generated SingleForm, to display two panels of the same type one in find mode and other in data mode.
    I changed the jbInit method of the "LayoutPanel" class to be like:
    //declare this as a member of the class.
    JButton findBtn;
    public void jbInit() throws Exception
    // Panel layout
    masterViewPanel = new PanelDeptView(panelBinding);
    //create another instance of PanelBinding for a second (findform) DeptView panel.
    JUPanelBinding binding = new JUPanelBinding("Project3.Mypackage1Module", this);
    binding.setApplication(panelBinding.getApplication());
    masterViewPanel1 = new PanelDeptView(binding); //create second instance
    findBtn = masterViewPanel1.navBar.getButton(JUNavigationBar.BUTTON_FIND);
    findBtn.doClick(); //set the second instance in find mode.
    //add a listener on the second instance's execute button so that it resets the form into find mode
    //this forces the second instance to be in find mode when execute button is pressed.
    masterViewPanel1.navBar.getButton(JUNavigationBar.BUTTON_EXECUTE).addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ev)
    SwingUtilities.invokeLater(new Runnable() {
    public void run()
    findBtn.doClick();
    this.setLayout(panelLayout);
    add(masterViewPanel, BorderLayout.WEST);
    //add the second instance.
    add(masterViewPanel1, BorderLayout.EAST);
    I also had to call findBtn.doClick() again in the "constructor" that takes (JUApplication, boolean) after the panelBinding is executed,
    to force the initial startup of this panel in findmode

  • Dynamic query in where clause while looping in an internal table.

    Hi,
    Had a small question : How can i make a dynamic query for the WHERE clause while looping at an internal table.
    i want to implement a dynamic where clause query for the below example.
    it_cfx_col is an internal table and wa_cfx_col is a work area for it_cfx_col
      DATA :
      i_cfx_col TYPE TABLE OF cfx_col,
      wa_cfx_col LIKE LINE OF i_cfx_col.
    DATA : count TYPE i VALUE 0.
    DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
    LOOP AT it_cfx_col INTO wa_cfx_col
    WHERE CREATED_BY = l_name
    AND SCENARIO = l_scenario.
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    Now i want to write a dynamic query for the where clause.
    DATA : count TYPE i VALUE 0.
      DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
      l_where_clause = 'CREATED_BY = l_name'.
      l_where_clause2 = 'AND SCENARIO = l_scenario'.
    if l_scenario is not initial.
      CONCATENATE  l_where_clause l_where_clause2
      INTO l_where_clause SEPARATED BY space.
    endif.
    LOOP AT i_cfx_col INTO wa_cfx_col
    WHERE (l_where_clause).
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    when i compile this i get an error message as { Statement concluding with "...(l_where_clause)" ended unexpectedly}
    Even i changed the initilization of the variable  l_where_clause2 to [ l_where_clause2 = 'AND SCENARIO = l_scenario.'. ]
    added the end of line demarkation ".", but still i got the same error message.
    Is it a limtation in ABAP that i cannot write a dynamic query for the where clause while looping at an internal table?
    Regards,
    om

    Hi savita,
    there in no such 1 limitaion in abap for dynamic query .. i think the  error meassge is only beacuse of your synatx delcartaion.
    >> LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE (l_where_clause).
       count = count + 1.
    some business logic implemented using the work     area    wa_cfx_col
       endloop.
    afted delclarataion also , in the where statement you should specify both the field name and value bname
       LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE l_where_clause = 'CREATED_BY = l_name' .
       count = count + 1.
    hope it helps.
    regads
    priya.

  • Dynamic Query

    Dynamic Query
    When I run the following dynamic query in the stored procedure and try to build the report then I get the following error Rep:1401 Fatal PL/SQL error occured, Ora-00936 Missing expression. When I am generating the report standalone using the following query , everything is working fine but in Stored procedure , it's giving me the above error, pls help.
    create or replace package REP_DELIVERY_LOC_STATISTICS is
    TYPE REP_DELIVERY_LOC_STAT_rec IS RECORD(
    p_coordinating_facility_id sis_education_pgm_session.coordinating_facility_id%TYPE,
    p_PSE_MUNICIPALITY_ID pse_education_pgm_session.PSE_MUNICIPALITY_ID%TYPE,
    p_pse_education_pgm_session_id sis_education_pgm_session.pse_education_pgm_session_id%TYPE,
    p_course_session_id course_session.course_session_id%TYPE);
    TYPE REP_DELIVERY_LOC_STAT_cur IS REF CURSOR RETURN REP_DELIVERY_LOC_STAT_rec;
    Type REP_DELIVERY_LOC_STAT_cur_Dyn is REF CURSOR;
    FUNCTION REP_DELIVERY_LOC_STATISTICS(p_college_id IN pse_education_pgm_session.delivery_institution_id%TYPE,
    p_start_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_end_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_coord_facility_join IN varchar2) return REP_DELIVERY_LOC_STAT_cur_Dyn;
    end REP_DELIVERY_LOC_STATISTICS;
    create or replace package body REP_DELIVERY_LOC_STATISTICS is
    FUNCTION REP_DELIVERY_LOC_STATISTICS(p_college_id IN pse_education_pgm_session.delivery_institution_id%TYPE,
    p_start_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_end_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_coord_facility_join varchar2) return REP_DELIVERY_LOC_STAT_cur_Dyn IS
    REP_DELIV_LOC_STAT_CUR_Dyn_Q REP_DELIVERY_LOC_STAT_cur_Dyn;
    BEGIN
    OPEN REP_DELIV_LOC_STAT_CUR_Dyn_Q FOR
    'SELECT distinct
    seps.coordinating_facility_id,
    peps.PSE_MUNICIPALITY_ID,
    seps.pse_education_pgm_session_id,
    cs.course_session_id
    FROM pse_education_pgm_session peps,
    sis_education_pgm_session seps,
    course_session cs,
    facility fac,
    desc_sis_reporting_area depa,
    desc_sis_reporting_type dept,
    pse_education_program pep
    WHERE peps.delivery_institution_id (+) = ' || p_college_id
    || ' and peps.session_strt_dte between ' ||p_start_date||' and ' || p_end_date
    || ' and seps.coordinating_facility_id = fac.facility_id (+)
    and seps.pse_education_pgm_session_id (+) = peps.pse_education_pgm_session_id
    and seps.pse_education_pgm_session_id = cs.pse_education_pgm_session_id (+)
    and pep.pse_education_program_id = peps.pse_education_program_id
    and dept.desc_sis_reporting_area_id = depa.desc_sis_reporting_area_id
    and pep.desc_sis_reporting_type_id = dept.desc_sis_reporting_type_id
    and dept.desc_sis_reporting_area_id = depa.desc_sis_reporting_area_id
    and fac.desc_facility_id in (2,3)' || NVL (p_coord_facility_join, '1=1');
    return REP_DELIV_LOC_STAT_CUR_Dyn_Q;
    END;
    end REP_DELIVERY_LOC_STATISTICS;

    I would sugest to grab a book like
    Inside Microsoft SQL Server 2008 T-SQL Querying (chapter 12 - Graphs, Trees, Hierarchies and Recursive Queries) or
    Joe Celko's Trees and Hierarchies in SQL for Smarties to get familiar with how model hierarchies using SQL.
    What is the meaning of the asterisks in the path?
    Here is a dirty example using the Adjacency List model.
    SET NOCOUNT ON;
    USE tempdb;
    GO
    CREATE TABLE dbo.T1 (
    id int NOT NULL UNIQUE CLUSTERED,
    name varchar(50),
    rootid int NULL
    INSERT INTO dbo.T1 (id,name,rootid)
    SELECT 1, 'animals', NULL
    UNION ALL
    SELECT 2, 'mamal', 1
    UNION ALL
    SELECT 3, 'cephalopod mollusc', 1
    UNION ALL
    SELECT 4, 'salt water fish', 1
    UNION ALL
    SELECT 5, 'fresh water fish', 1
    UNION ALL
    SELECT 6,'whale', 2
    UNION ALL
    SELECT 7,'pirana', 5
    UNION
    SELECT 8,'shark', 4
    UNION
    SELECT 9, 'octopus', 3;
    GO
    WITH Tree AS (
    SELECT
    id, name, rootid,
    CAST('/' + [name] + '/' AS varchar(900)) AS mat_path
    FROM
    dbo.T1
    WHERE
    rootid IS NULL
    UNION ALL
    SELECT
    C.id, C.name, C.rootid, CAST(P.mat_path + C.name + '/' AS varchar(900))
    FROM
    Tree AS P
    INNER JOIN
    dbo.T1 AS C
    ON P.id = C.rootid
    SELECT
    FROM
    Tree
    ORDER BY
    mat_path;
    GO
    DROP TABLE dbo.T1;
    GO
    Excuse my poor knowledge of zoology or animal biology.
    AMB
    Some guidelines for posting questions...
    AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas

  • Dynamic Query Doubt

    Hi,
    I need to write a Dynamic Query to get the data from the table by using the Input date parameters.
    LIke,
    SELECT* from table where date_start between to_date('12-14-2004','mm-dd-yyyy') AND
    to_date('12-15-2005','mm-dd-yyyy');
    How can i write the above query in dynamic sql as i will get the two dates as input in my procedure
    Help me in this

    Or more preferably use bind variables with the
    EXECUTE IMMEDIATE as, if the query will be called
    many times, the bind variables will prevent hard
    parsing of the statement each time (i.e. it will be
    quicker to execute).blushadow,
    Yes, the execute immediate using bind variables is better/faster than not using bind variables, but your first example outperforms your second one. This is due to the fact that execute immediate really closes all cursors, and in your first example the cursors are kept open (yes, even though you issue a CLOSE cur_test) in the PL/SQL cursor cache.
    SQL> create table i_links
      2  as
      3  select sysdate - l linkdate from (select level l from dual connect by level <= 10000)
      4  /
    Tabel is aangemaakt.
    SQL> exec dbms_stats.gather_table_stats(user,'I_LINKS')
    PL/SQL-procedure is geslaagd.
    SQL> create or replace procedure test1 (start_date in date, end_date in date) as
      2    CURSOR cur_test IS
      3      SELECT count(*)
      4      FROM   i_links
      5      WHERE  linkdate BETWEEN start_date AND end_date;
      6    v_count NUMBER;
      7  begin
      8    OPEN cur_test;
      9    FETCH cur_test INTO v_count;
    10    CLOSE cur_test;
    11    --DBMS_OUTPUT.PUT_LINE('Count: '||v_count);
    12  end;
    13  /
    Procedure is aangemaakt.
    SQL> create or replace procedure test2 (start_date in date, end_date in date) as
      2    v_count NUMBER;
      3  begin
      4    EXECUTE IMMEDIATE 'SELECT count(*) FROM i_links WHERE linkdate BETWEEN :x1 AND :x2' INTO v_count USING start_date, end_date;
      5    --DBMS_OUTPUT.PUT_LINE('Count: '||v_count);
      6  end;
      7  /
    Procedure is aangemaakt.
    SQL> begin
      2    -- warm up
      3    test1(sysdate-365,sysdate);
      4    test2(sysdate-365,sysdate);
      5    -- begin test
      6    runstats_pkg.rs_start;
      7    for i in 1..1000
      8    loop
      9      test1(sysdate-365,sysdate);
    10    end loop;
    11    runstats_pkg.rs_middle;
    12    for i in 1..1000
    13    loop
    14      test2(sysdate-365,sysdate);
    15    end loop;
    16    runstats_pkg.rs_stop(100);
    17  end;
    18  /
    Run1 draaide in 341 hsecs
    Run2 draaide in 348 hsecs
    Run1 draaide in 97,99% van de tijd
    Naam                                                    Run1      Run2  Verschil
    STAT.session cursor cache hits                             0       998       998
    STAT.opened cursors cumulative                             0     1,000     1,000
    STAT.parse count (total)                                   0     1,000     1,000
    LATCH.shared pool                                      1,047     3,043     1,996
    STAT.recursive calls                                   3,001     1,001    -2,000
    LATCH.library cache pin allocation                         8     2,011     2,003
    LATCH.library cache pin 2,048 6,044 3,996
    LATCH.library cache 2,056 6,060 4,004
    Run1 latches totaal versus run2 -- verschil en percentage
          Run1      Run2  Verschil     Pct
        48,522    60,548    12,026  80.14%
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • Dynamic query configuration in sender jdbc adapter

    Hi,
    According my undertsnading in XI.3.0 dynamic query in sender JDBC adapter is not possible.
    could any one confirms the possibility of this feature in XI 7.0 .
    Thanks,
    venu

    Hi VJ,
    sorry for late responding to your answer.
    One of our requirements is the query statement that we write in sender communication channel should be changed dynamically, for example in where condition the condition parameters values required to change.
    Thanks,
    venu

  • Dynamic Query in Report Builder

    HI
    I have a doubt:
    I need to receive a parameter in my report and I need this parameter in the query, that means, I need to create a dynamic query depending on the value that I receive in one of the parameters that has my report.
    I tried to use the resource of Searching by Reference Cursor tool, it is a blue circle in the Data Model View of Report Builder.
    When I click this tool, I have an initial code, It is:
    function QR_1RefCurDS return <RefCurType> is
    begin
    end;
    In PL/SQL I tried to create to test and to play, this code:
    Note: If you want to try only to test, it is simple and works:
    create or replace package TEST_REFCURTYPE as
    type refcurtype is ref cursor;
    function TEST_REFCURTYPE (P_DATE_TO nvarchar2) return refcurtype;
    end;
    create or replace package body TEST_REFCURTYPE as
    function TEST_REFCURTYPE (P_DATE_TO nvarchar2)
    return refcurtype is
    refcur refcurtype;
    mysql varchar(1000);
    begin
    If P_DATE_TO is not null then
    mysql := 'select '''|| P_DATE_TO ||''' from dual';
    else
    mysql := 'select sysdate from dual';
    end if;
    open refcur for mysql;
    return refcur;
    end;
    end;
    The problem is to pass this example of code to the function QR_1RefCurDS, I do not have a place to make reference to the type:
    type refcurtype is ref cursor;
    I tested the Unit Program in the Report Builder but it did not work, because all the code I try to write and create, for example in the Event BEFORE REPORT, it opens  Funcion( ) …., and I can not make reference to the type refcurtype inside a Function( ).
    Would you help me please?
    Or there is another way to make a dynamic query in the Report Builder?
    Sorry for my English, I am a Brazilian living in Spain.

    Hi,
    you can use lexical parameters in your queries. Instead of a ":" use in the query before the parameter a "&". Then the parameter stands for a part of the query and not for a value (Bind parameter). In the before report trigger you can set this parameters. They can contain parts of SQL like order or where. Make sure that the default value for this lexical parameters are set to get a valid query.
    SELECT ENAME, &p_column as COL2 FROM EMP &p_order
    and in the trigger something like
    IF :p_which_column = 1 THEN
    :p_column := 'SAL'
    ELSE
    Saludos
    Rainer

  • How to enhance Dynamic Query Object TerrSearch (Territory Management)?

    Hello Friends,
    In the TerrSearch dynamic query object, There are 2 fields Territory_ID and Level_ID. Now i have a requirement to Enhance the Search object using the new field called TERRITORY PATH ID. using which we can search all the entities not only for the terrritory level which we have selected (for example we have assigned the value '01' to LEVEL_ID) but also all the below territory levels of selected territory level.
    If we enhance the search object structure CRMST_TMIL_SEARCH (structure of TerrSearch object) using AET to add the Z field called TERRITORY_PATH_ID then which is the suitable BADI where we can add the necessary code to select all the entities based on all the territory levels below the selected territory level.
    Please guide me friends how to enhance the TerrSearch object.

    Hi friend,
    Try using MACRO and dynamic WHERE condition.
    Group simialr Select statements under a Macro.
    Build a dynamic where by checking conditions
    Call macro passing dynamic where condition.
    TABLES afpo.
    DATA: str TYPE string.
    *Macro definition
    DEFINE operation.
      select single *
           from afpo into afpo
           where (&1).    " Dynamic condition
    END-OF-DEFINITION.
    *Build dynamic WHERE by checking some conditions
    *If conditon 
    CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0001''' INTO str SEPARATED BY space.
    *Else
    CONCATENATE 'AUFNR = ''000000700008''' 'AND POSNR = ''0002''' INTO str SEPARATED BY space.
    *Endif.
    *Call Macro passing dynamic WHERE condition
    operation str.

  • Dynamic Querying in ESB

    Hey,
    I am trying to implement dynamic querying using the query by example concept. My requirement is as follows:
    "Say I have 5 inputs , I need to fetch rows from the database using those 5 inputs as a part of my where clause"
    The user input are optional. Hence using the query by example concept I was able to filter rows.
    But the problem is as follows:
    1) I have a "time from" and "a time to" field as user inputs. I need to filter the fetched rows so that time is in that time range only. I do not know how to implement this also along with the above concept as there is no place for a where clause.
    Any help/suggestions would be appreciated.
    Thanks

    I tried applying the patch, but it gives the following error:
    OPatch detects your platform as 207 while this patch 6133448 supports platforms:
    0 (Generic Platform)
    This patch is not suitable for this operating system.
    Please contact support for the correct patch.
    ERROR: OPatch failed during pre-reqs check.
    OPatch returns with error code = 150
    I downloaded for the OS I am on, but always the generic patch downloads; i guess this generic one should work for all platforms. Opatch version is 1.0.0.0.56.

  • Generating Dynamic Query for Ad-Hoc Reports

    Hello,
    What is the best way to create a dynamic query to generate ad-hoc reports? I have a couple of ideas but not sure which would work best and be most flexible.
    I would like our users to be able to check checkboxes for what data they would like returned in their report. The data would be pulled from a number of tables, 10+, depending on what pieces of data they checked.
    Should I write one dynamic query, with a bunch of IF statements in it?
    Should I write many individual queries and then join them together in a temp query?
    Should I create a temp table on our SQL server which contains the data from all of the tables; then query that? (I am worried about data being out-of-date with this option.)
    Which one of these solutions should I go with or is there a better solution that I am not considering?
    Thanks for the help.
    Josh

    Do you mean a Stored Procedure? Would the Stored Procedure then have one query on it with a bunch if IF statements? Maybe a bad example, but something like this?
    Yep.
    I haven't written a proc for a coupla years (I have DB people to do that for me now, bless 'em), but every DB is different, so the approach will vary depending on what DB you have.  It's perhaps time to buy a book or do a google or something.
    Adam

  • How to create custom BOL object for dynamic query in CRM 7.0

    Hi,
    Could anyone please explain me with steps that how to create the custom BOL object for dynamic query in CRM 7.0, I did it in previous version but its throwing exception when i try to create the object of my dynamic query class. I just defined the entry of my in crmv_obj_btil to create the dynamic query BOL object. do i need to do any other thing also to make it work?
    Regards,
    Kamesh Bathla
    Edited by: Kamesh Bathla on Jul 6, 2009 5:12 PM

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • Dynamic query to produce crosstab/pivot report

    Hello,
    I've not been able to find any examples similar to my situation but perhaps I'm using the wrong search phrases...
    I'm basically trying to create a cross-tab type report based on a dynamic query (since I do not know how many accounts a person has):
    select '  SELECT x.name, x.type, ' from dual
    union
    select ' max(decode(x.account,'''||m.account||''',x.amount,null)) as "'||substr(s.proj||' '||m.account,1,30)||'",'
      from db1.manager m, db1.person p, pi.charges c, db1.status s
    where m.manager_id = p.id
       and M.ACCOUNT_ID = C.ACCT_ID
       and M.ACCOUNT_STRING = S.project
       and C.JNL = (select max(id) from db1.journ j where j.TYPE ='M')
       and p.username = :username
       and nvl(M.END_DATE, sysdate +1) >= sysdate
    group by m.account, s.proj
    union
    select 'sum(x.amount) grand_total from (select m.account, c.name, c.type, c.amount '
              ||'from db1.manager m, db1.person p, pi.charges c '
              ||'where m.manager_id = p.id '
              ||'and p.username = :P68_PRINC '
              ||'and c.acct_id = m.account_id '
              ||'and c.jnl = (select max(id) '
              ||'from db1.journ j where j.TYPE =''M'')) x '
              ||' group by type, name' from dualThe output from this query for the particular manager I selected is:
    SELECT x.name, x.type,
    max(decode(x.account,'12012',x.amount,null)) as "Internal 12012",
    max(decode(x.account,'17929',x.amount,null)) as "Staged 17929",
    max(decode(x.account,'18054',x.amount,null)) as "Help Software 18054",
    max(decode(x.account,'3428',x.amount,null)) as "Mow 3428",
    max(decode(x.account,'3428',x.amount,null)) as "Mow 3428_1",
    max(decode(x.account,'3508',x.amount,null)) as "Stampede 3508",
    max(decode(x.account,'9102',x.amount,null)) as "Open Collaborative 9102",
    sum(x.amount) grand_total
    from (select m.account, c.name, c.type, c.amount
    from db1.manager m, db1.person p, pi.charges c
    where m.manager_id = p.id
        and p.username = :P68_PRINC
        and c.acct_id = m.account_id
        and c.jnl = (select max(id)
       from db1.journ j where j.TYPE ='M')) x
      group by type, nameThis query generates another query that ultimately produces the report below (please pardon the alignment) that I want to see on a report page.
    NAME     TYPE     Internal 12012     Staged 17929     Help Software 18054     Mow 3428     Mow 3428_1     Stampede 3508     Open Collaborative 9102     GRAND_TOTAL
    #EXAM1221     M                                                                            22                                                                                             22
    #EXAM1222     M                          14.83             14.77                     12.56                          2.22                                                          44.38
    #EXAM1223     M                          6.73                 6.7                             5.7                                  1                                                          20.13
    THOEORY       M                          106.5                                                                                                                                      106.5Should I be using the report type that is based on a 'PL/SQL function body returning SQL query' for this type of report??? If so, how does that get set up?
    Thanks in advance!
    ~Jake

    This solution works in that it generates the proper query. I can copy the query (from debug mode) and paste it in TOAD and it works perfectly. However, in the report page it tells me: "report error:ORA-01403: no data found".
    I found this thread: report error: ORA-01403: no data found when SUM columns
    I did have a couple other regions on the page (previous attempts) that were hidden so I deleted them completely. Still no luck.
    I am also summing up several columns...if that has anything to do with it.
    Does anyone have any suggestions?
    Thanks again!!!
    ~Jake
    Edited by: jhammer on Jul 27, 2010 11:02 AM

  • Query a stored procedure that exec's a dynamic query. Error Linked server indicates object has no columns

    I have a stored procedure that dynamically creates a pivot query.  The procedure works and returns the correct data.  Now I have a requirement to show this data in reporting system that can only pull from a table or view.  Since you can not
    create a dynamic query in a view I tried to do a select from using openquery. 
    Example 'Select * from OpenQuery([MyServername], 'Exec Instance.Schema.StoredProcedure')
    I get the error back "the linked server indicates the object has no columns".  I assume this is because of the first select statement that is stuffing the variable with column names. 
    CODE FROM PROCEDURE
    Alter PROCEDURE [dbo].[Procedure1]
    AS
    BEGIN
    SET NOCOUNT ON
    Declare @cols nvarchar(2000),
      @Tcols nvarchar(2000),
      @Sql nvarchar (max)
    select @cols = stuff ((
          Select distinct '], ['+ModelName + '  ' + CombustorName
           from CombustorFuel cf
           join Model m on cf.modelid = m.modelid
           join Combustors cb on cf.CombustorID = cb.CombustorID
           where cf.CombustorID > 0
           for XML Path('')
          ),1,2,'')+']'
    Set @Tcols = replace(@Cols, ']', '] int')
    --Print @Tcols   
    --Print @Cols
    Set @Sql = 'Select GasLiquid, FuelType, '+ @Cols +'
    from
     Select GasLiquid, FuelType, ModelName+ ''  '' +CombustorName ModelCombustor, CombFuelStatus+''- ''+CombFuelNote CombFuelStatusNote
      from Frames f
      join Family fa on f.Frameid = fa.frameid
      join Model m on fa.FamilyID = m.FamilyID
      join CombustorFuel cf on m.Modelid = cf.modelid
      Join Combustors c on cf.CombustorId = c.CombustorID
      join FuelTypes ft on cf.FuelTypeID = ft.FuelTypeID
      where cf.CombustorFuelID > 0
        and CombustorName <> ''''
     ) up
    Pivot
     (max(CombFuelStatusNote) for ModelCombustor in ('+ @Cols +')) as pvt
    order by FuelType'
    exec (@Sql)

    Then again, a good reporting tool should be able to do dynamic pivot on its own, because dynamic pivoting is a presentation feature.
    SSRS Supports dynamic columns: Displaying Dynamic Columns in SSRS Report
    SQL Reporting Services with Dynamic Column Reports
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014
    Displaying and reading are two very different things.
    #1) SSRS Needs a fixed field list on the input side to know what what to make available in the designer.
    #2) SSRS cant read "exec (@Sql)" out of a proc, even if there is a fixed number of columns (at
    least it can't use it to auto build the field list from the proc)
    I use dynamic SQL in my report procs on a fairly regular basis and I've found it easiest to simply dump
    the results of my dynamic sql into a temp table at the end of the procs and then select from the temp table.
    Basically, Erland is correct. Stop trying to pivot in the query and let SSRS (or whatever reporting software you're using) handle it with a Martix.
    Jason Long

  • Returning a result set/record from a dynamic query

    There seems to be plenty of examples for using Native Dynamic Sql to formulate and execute a dynamic query, however there are no examples of returning a result set or records which contain the rows of data that are retrieved by executing the query. Could someone give us an example?

    Welcome to the Oracle forum....
    CREATE OR REPLACE PACKAGE curspkg_join AS
    TYPE t_cursor IS REF CURSOR ;
    Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor);
    END curspkg_join;
    Create the following Oracle package body on the Oracle server:
    CREATE OR REPLACE PACKAGE BODY curspkg_join AS
    Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor)
    IS
    v_cursor t_cursor;
    BEGIN
    IF n_EMPNO <> 0
    THEN
    OPEN v_cursor FOR
    SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO
    AND EMP.EMPNO = n_EMPNO;
    ELSE
    OPEN v_cursor FOR
    SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO;
    END IF;
    io_cursor := v_cursor;
    END open_join_cursor1;
    END curspkg_join;
    Dim Oraclecon As New OracleConnection("Password=pwd;" & _
    "User ID=uid;Data Source=MyOracle;")
    Oraclecon.Open()
    Dim myCMD As New OracleCommand()
    myCMD.Connection = Oraclecon
    myCMD.CommandText = "curspkg_join.open_join_cursor1"
    myCMD.CommandType = CommandType.StoredProcedure
    myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
    myCMD.Parameters.Add("n_Empno", OracleType.Number, 4).Value = 123
    Dim myReader As OracleDataReader
    Try
    myCMD.ExecuteNonQuery()
    Catch myex As Exception
    MsgBox(myex.Message)
    End Try
    myReader = myCMD.Parameters("io_cursor").Value
    Dim x, count As Integer
    count = 0
    Do While myReader.Read()
    For x = 0 To myReader.FieldCount - 1
    Console.Write(myReader(x) & " ")
    Next
    Console.WriteLine()
    count += 1
    Loop
    MsgBox(count & " Rows Returned.")
    myReader.Close()
    Oraclecon.Close()
    The above code is working in one of our application; which is using ref cursor as result set and get from procedure. I hope you can found more code by google and/or search in this forum as well; if above code is not useful to you.
    HTH
    Girish Sharma

Maybe you are looking for

  • Switched from MacBook to MacBook Pro

    I finally have my laptop of choice. But, I forgot to get files off the old one (iTunes library, iPhoto, etc.) before I sold it. Can I get them using my mobile.me account if I had them stored there previously? Also, I finally have everything I need to

  • Process definition for utilities

    Hello all, I´m looking the standard process definition in CRM. Customizing: Customer Relationship Management - Industry-Specific Solutions - Utility Industries - Settings for User Interfaces - Transaction Processing - Processes - Define Processes I w

  • CC Application Manager wont launch following failed update

    The app mgr told me this morning there were an update for it so I ran it.  It ran for about a half hour with the progress bar never completing so finally I killed it and an error msg came up that unfortunately I did not save.  I got home after work a

  • Anyconnect client under Mac OS X

    Hi, I've got a short trouble running anyconnect client 2.3.254 under Mac OS X 10.5.6. If I use it to connect an ASA 8.0.4 through a proxy (squid) it doesn't work. If I use Win XP, with same proxy, it works. If I don't use any proxy, with my Mac OS X

  • Few people are "Oracle ACE" and "Java Champion"

    Few people are "Oracle ACE" and "Java Champion" What's whose icon ?:| I think that icon should not be only one. For instance,I am Pro (I have 570 points) and "Oracle ACE". Therefore I hope that My icons are "Pro" and "Oracle ACE".