How to dynamically build where clause in Linq

Hello everyone,
Oracle DB:11gR2
Oracle Client: 11.2.0.3.0 (ODP.NET)
Oracle Developer Tools for Visual Studio
VS 2010 (C#)
In a Windows Form, we need to query the data based on the values of dropdown listboxes, which user will select.
Let's say, two combox, one is for Department and one is for Salary
Department:
-1 All
10 Department 1
20 Department 2
30 Department 3
Salary:
-1 All
1 < 20000
2 20000 to 50000
3 50000 to 100000
4 > 100000
Here is C# code to query data:
using (var myEDMctx = new HREntities())
var LINQrslt = from emp in myEDMctx.EMPLOYEES
select emp;
The default values for both combox should be All.
How to write the dynamic where clause for this LINQ?
Thanks in advance!!!

There is nothing Oracle-specific about dynamic LINQ queries. Dynamic LINQ queries are handled all the same way, no matter which data source you use. Microsoft describes how to use Dynamic LINQ here:
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
http://weblogs.asp.net/davidfowler/archive/2010/08/19/dynamic-linq-part-2-evolution.aspx

Similar Messages

  • Dynamic XQuery Where clause

    I have the following schema:
    <?xml version="1.0"?>
    <xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="CountryRiskService"
    targetNamespace="CountryRiskService"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">
    <xs:element name="CountryRiskParameters">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="countryId" type="xs:int" minOccurs="1" maxOccurs="unbounded"/>
    <xs:element name="catA" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    I am passing this into my Logical Data Service, what I want to do is create a dynamic XQuery where clause if the catA field is populated, ignore it if it isn’t, so basically, I want to be able to create a dynamic query based on the parameters requested, so I have the following XQUERY:
    declare function tns:getCountries($countryRiskInput as element(ns7:CountryRiskParameters)) as element(ns0:CountryRiskInfo)* {
    for $tbl_high_risk_countries in ns1:tbl_high_risk_countries()
    where $countryRiskInput/ns4:countryId = $tbl_high_risk_countries/country_id
    where $countryRiskInput/ns4:catA = $tbl_high_risk_countries/risk_catA
    I really thought that DSP would be able to handle this on the fly since the element is optional but if I don’t populate it, I get nothing back, the idea is I want to increase the number of elements in my schema so my consumers have the ability to filter the results they want, so above, I don’t want the second where clause if catA isn't specified, any ideas how to accomplish this?

    Simply add the disjunction of the input being empty.
    for $tbl_high_risk_countries in ns1:tbl_high_risk_countries()
    where $countryRiskInput/ns4:countryId = $tbl_high_risk_countries/country_id
    where ( $countryRiskInput/ns4:catA = $tbl_high_risk_countries/risk_catA or empty( $countryRiskInput/ns4:catA )
    But suppose you have 27 different elements that you might want to filter on - the xquery gets long and ugly. You might want to looking into using FilterXQuery. Visit http://edocs.bea.com/aldsp/docs25/, search on FilterXQuery, look for the tutorial.
    If your queries get more complicated, you would do well to look into generating ad hoc queries. (edocs as well).

  • Need help in clearing string buffer during dynamic VO where clause in oaf

    Hi All,
    I am dynamically setting where clause in OAF using string buffer, but the issue is when i am executing the vo multiple times so the old data in the string buffer it is not clearing .so every time my where clause adding to the query and it is erroring out, please help me how to clear string buffer class in oaf.
    Thnaks

    Hi,
    Could you please share the code segment for reference. Then we can tell the solution.
    Regards,
    Tarun

  • How build where clause in select statement in FM for Virtual provider

    Hi
    I looking for example of FM for Virtual provider where I find code how assign to select statement "where" clause value from query variable.
    In following code how build t_r_custtype range and how assign value to it.
    CODE********************************
    TYPE-POOLS: abap.
    initialize
      CLEAR: e_t_data, e_t_msg.
    this is specific to infoprovider VIRTPROV
      CHECK i_infoprov = 'VIRTPROV'.
      FIELD-SYMBOLS: <l_s_sbook> TYPE sbook,
                     <l_s_data>  TYPE ANY.
      DATA: l_t_component TYPE abap_compdescr_tab,
            l_t_sbook     TYPE TABLE OF sbook.
    initialize
      CLEAR e_t_data.
    Data selection / only Business Customer
      SELECT * FROM sbook
        INTO CORRESPONDING FIELDS OF TABLE l_t_sbook
        WHERE custtype in t_r_custtype.
    ENDCODE********************************
    Thanks a lot
    Adam

    Hello,
    Would you like fill the ranges in Customer exit for BEx..? 
    If Yes. please refer the attachment for the whole code...
    "Sample code in Customer Exit in BEx"
    IF i_step = 2.
    CASE i_vnam.
    WHEN 'ZDAY_CX'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT2
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZLSDAY.
    E_TT =
    E_ULTKZ =
    l_s_range-low = ZFIDAY .
    l_s_range-high = ZLSDAY .
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    **To get the From date (For Text Variable) as per the user input date interval range**
    WHEN 'ZR_S'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = 0
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    l_s_range-low0(2) = ZFIDAY6(2).
    l_s_range-low+2(1) = '.'.
    l_s_range-low3(2) = ZFIDAY4(2).
    l_s_range-low+5(1) ='.'.
    l_s_range-low6(4) = ZFIDAY0(4).
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    Please let me know if any clarification required..
    Rinku..

  • How to edit the where clause of View object in search example dynamically

    Hi,
    I am new to OA Framework. Can anybody please tell me how can I assign the where clause dynamically. I want to search only those rows whose creation date is between a 'Date form' and 'Date to' inputs from the search page
    Thanks
    Anupam

    user567342 ,
    I will advice u again pls refer dev guide, there u can find code sample for ur requirement, which can be accomplished using stringbuffer.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to set the where clause of a value set on the basis of a form field

    I am using a DFF(Descriptive FlexField), which needs to display the value of a certain column(say columnA) on the basis of the value of another column(say columnB).
    So i have created a value set which points to the table which has both these columns, and the DFF uses this value set. However, the problem is that I have not put any where clause in the value set, because of which i cannot handle the exact fetch returns more than one rows error.
    The query has to be as follows:
    select ColumnA from tbl where ColumnB = [ a form value ];
    What I want to know is how can i get the value of a certain field of a certain block of the form in the above query.
    Edited by: 981615 on Jan 14, 2013 12:48 AM
    Edited by: 981615 on Jan 14, 2013 12:48 AM

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • Issue with dynamically setting where clause in OAF

    Hi All,
    I have a View object having the query below:
    SELECT  rownum LINENUM,
            B.line_id LINE_ID,
            B.INVENTORY_ITEM_ID INVITMID ,
            B.QUANTITY_DELIVERED PICKQTY         
    from   MTL_TXN_REQUEST_HEADERS A,
            MTL_TXN_REQUEST_LINES  B
      WHERE A.HEADER_ID=B.HEADER_ID
       AND A.MOVE_ORDER_TYPE=2 
       AND 'on'=:1
       AND B.TO_SUBINVENTORY_CODE=NVL(:4,B.TO_SUBINVENTORY_CODE)
       AND A.request_number=NVL(:5,A.REQUEST_NUMBER) 
    UNION ALL
    SELECT  rownum LINENUM,
            a.wip_entity_id LINE_ID,
            a.INVENTORY_ITEM_ID INVITMID,
            a.QUANTITY_ISSUED PICKQTY      
      FROM  WIP_REQUIREMENT_OPERATIONS a,
            eam_work_orders_v b
      WHERE a.wip_entity_id=b.wip_entity_id
         AND 'on'=:2
        AND a.ATTRIBUTE2=NVL(:4,a.ATTRIBUTE2)
      and b.wip_entity_name=NVL(:6,b.wip_entity_name)
    I need to pass dynamically a condition to my where clause that i can handle it by defining two bind parameters in the vo query and can pass it but the problem is the bind variable contains a string like 1311,13112,14445 that i need to pass for a field such as B.line_id in the first query and b.wip_entity_id in the second query so when i am trying by passing the string as one value it is working fine but for value separetd by comma it is giving prob.
    so i tried by passing dynamic where clause but it is everytime executing for first clause only how i can pass dynamically both the queries.
    vo.setWhereClause("LINE_ID in "+wherclause);
    please help me out
    Thnaks
    Deb

    Hi Gaurav,
    Thnaks for the reply i tried belwo way u suggested but the query is executing multiple times and i am not getting the correct data as expected.
    public void processPOData (String wherclause)
                 OAViewObject vo = this.getXXDPECONTAINLINESVO1();
                    String query =vo.getQuery();
                    String newwhereclause ="LINE_ID = "+wherclause;
                    StringBuffer stringbuffer = new StringBuffer();  
                stringbuffer.append("SELECT * FROM (");
                stringbuffer.append(query);
                stringbuffer.append(") where ");
                stringbuffer.append(newwhereclause);          
        ViewDefImpl viewdefimpl = getXXDPECONTAINLINESVO1().getViewDefinition();
                viewdefimpl.setQuery(stringbuffer.toString());
                 vo.reset();
                 vo.clearCache();
                vo.executeQuery();
                    System.out.println("where clause:"+wherclause);
    in my log file the query is forming like below:
    SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM ( SELECT * FROM ( SELECT  rownum LINENUM,
            B.line_id LINE_ID,
            B.INVENTORY_ITEM_ID INVITMID ,
            B.QUANTITY_DELIVERED PICKQTY ,
            B.TO_SUBINVENTORY_CODE UNLOADINGPNT,
            A.REQUEST_NUMBER RRNUM,
            NULL WORKORDNUM,
            NULL DTRNUM,
            A.description,
            A.FROM_SUBINVENTORY_CODE FROM_SUB,
            A.TO_SUBINVENTORY_CODE  TO_SUB,
            NULL SOURCE       
    from   MTL_TXN_REQUEST_HEADERS A,
            MTL_TXN_REQUEST_LINES  B
      WHERE A.HEADER_ID=B.HEADER_ID
       AND A.MOVE_ORDER_TYPE=2  
    UNION ALL
    SELECT  rownum LINENUM,
            a.wip_entity_id LINE_ID,
            a.INVENTORY_ITEM_ID INVITMID,
            a.QUANTITY_ISSUED PICKQTY,
            a.ATTRIBUTE2 UNLOADINGPNT,
            NULL RRNUM,
            b.WIP_ENTITY_NAME WORKORDNUM,
            NULL DTRNUM,
            b.description,
            NULL FROM_SUB,
            NULL TO_SUB,      
            b.source SOURCE
      FROM  WIP_REQUIREMENT_OPERATIONS a,
            eam_work_orders_v b
      WHERE a.wip_entity_id=b.wip_entity_id ) )) where LINE_ID = 30026) where LINE_ID = 30026) where LINE_ID = 30026
    But in my page i am getting all the data instead of only for line 30026, please help me out

  • How to establish a where clause dinamically in a form?

    I've a form with a table activities that must call (with a custom button) to a form with (only) the documents associated to this activity.
    In the BD i have the table Activities (pk=codi_acti), the table documents (pk=codi_docu) and one more table for associate both called activities_documents (pk=codi_acti, codi_docu).
    The user editing the activity X after click the button must see all the documents of X but nothing else.
    My first attempt was a MD Form with the table activities_documents as master and the table documents as detail, but documents have a blob column and then this is not possible.
    Now I'm trying to establish the where clause to perform this but I can't get it. I pass codi_acti to this (documents) form and then I should show all the documents that have codi_docu in the table activities_documents, otherwise SELECT * FROM documents WHERE codi_docu IN (SELECT codi_docu FROM activities_documents WHERE codi_docu=:codi_acti).
    How can I achieve this?
    Please Help!!!
    Sincerely
    David Montejo

    Forms can autoquery data based on the URL used to call the form. You can build the URL
    and call the form with the required query, on successfull form submission you can do the following
    begin
    declare
    my_url varchar2(2000);
    n_rl_id number;
    begin
    n_rh_id:=p_session.get_value_as_NUMBER(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_RH_ID',
    p_index => 1
    my_url := 'PORTAL30.wwa_app_module.link?' ||
    'p_arg_names=_moduleid&p_arg_values=<your form id>' ||
    '&p_arg_names=_show_header&p_arg_values=YES' ||
    '&p_arg_names=rh_id&p_arg_values=' || LTRIM(TO_CHAR(n_rh_id)) ||
    '&p_arg_names=_rh_id_cond&p_arg_values=%3D';
    -- %3d means "="
    go (my_url);
    end;
    end;

  • Query Builder - Where Clause - Could not format error using date comparison

    We've come across a bug in the Query Builder, under the Create Where Clause tab, if you select a column of Date type plus one of the comparison operators =, !=, <, >, <=, >=, BETWEEN or NOT BETWEEN it displays an error in the Logging Page:
    Level: Severe
    Source: o.d.r.queryBuilder.SQLGenerator
    Message: Could not format :2010-09-02 16:20:31.0
    Then under the Show SQL tab it doesn't display the date(s) you selected, e.g.
    WHERE LAST_UPDATE BETWEEN AND
    Also the View Results tab does not display any results.
    You can still press Apply to add the SQL as is to the editor window and from there you have to manually code in the date parameters.
    We're using the latest version of SQL Developer 2.1.1.64.45 Windows 32bit version with JDK

    Hi Gordon,
    When I add the following lines:
    declare @refdt1 date
    set @refdt =
    /*select 1 from jdt1 t0 where t0.RefDate*/ '[%1]'
    declare @refdt2 date
    set @refdt =
    /*select 1 from jdt2 t0 where t0.RefDate*/ '[%2]'
    WHERE T0.RefDate >= @refdt1 and T0.RefDate <= @refdt2
    ... the error message is now:
    Must declare the scalar variable @refdt1
    Note: Before adding these lines, the query works perfectly, and returns totals from the whole database (with dynamically generated column headings!)
    Thanks
    Leon Lai
    AMENDED QUERY:
    declare @refdt1 date
    set @refdt1 =
    /*select 1 from jdt1 t0 where t0.RefDate*/ '[%1]'
    declare @refdt2 date
    set @refdt2 =
    /*select 1 from jdt1 t0 where t0.RefDate*/ '[%2]'
    --------- I inserted the 6 lines above ---------------------
    DECLARE @listCol VARCHAR(2000)
    DECLARE @query VARCHAR(4000)
    SELECT @listCol =
    STUFF
    ( SELECT DISTINCT   '],['    +    CAST(month(T0.RefDate) AS varchar)
    FROM  JDT1 T0
    FOR XML PATH('')
    ), 1, 2, ' ') +   ']'
    SET @query =
    'SELECT * FROM
    (SELECT Account, month (T0.RefDate) Month , Debit
    FROM JDT1 T0
    ------------------- I add the WHERE clause below --------------------
    WHERE T0.RefDate >= @refdt1 and T0.RefDate <= @refdt2
    GROUP BY Account, RefDate, Debit
    ) S
    PIVOT
    Sum(Debit)
    FOR Month IN ('+@listCol+')
    ) AS pvt'
    EXECUTE (@query)
    Edited by: LEONLAI on Oct 21, 2011 2:36 PM

  • VPD - How to make the where clause a correlated query

    Hi,
    My VPD function has the following where clause:
    where_clause:= ' project_id in (select object_id from pa_project_classes p'||
    ' where p.class_category='||''''||l_cat||''''||
    ' and p.CLASS_CODE='||''''||l_class||''''||
    ' and p.OBJECT_TYPE=''PA_PROJECTS'''||
    The problem is that the subquery is not using the unique key defined on the table pa_project_classes. What I need is something as follows:
    where_clause:= ' project_id in (select object_id from pa_project_classes p'||
    ' where p.class_category='||''''||l_cat||''''||
    ' and p.CLASS_CODE='||''''||l_class||''''||
    ' and p.OBJECT_TYPE=''PA_PROJECTS'''||
    ' and p.object_id=mainquery.project_id ||
    The problem is that since the table pa_project_classes also has a column project_id, I have to prefix the column name by the alias of the main query like 'mainquery.project_id'. However this seems impossible as main query is not unknown .
    I would be grateful if you could suggest any workaround or solution.
    Thanks

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • Query API to build where clause

    Hi All ,
               Is there any API in the Netweaver Layer through which i can build open sql where clause by just passing the selection parameter table . I have tried using the cl_rsmds_*  api but it doesnot returns correct result in some senario.
    With regards,
    Saurabh Kumar Pandey .

    SELECT *
    FROM   table_name pr
    WHERE ( (pr.status_cid IN (5,86) OR ( pr.org_unit_sid = 3001 AND pr.status_cid IN (25))
    {code}
    PS: Kindly mark the answers to your post as helpfull/correct if you are satisfied
    Edited by: Himanshu Binjola on Apr 23, 2012 9:34 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to modify the where clause in this to include other things

    How do I modify the WHERE clause in this code:
    $expected = array(first_name, last_name, level, language, 'city', 'state', 'zip', );
    $query_search = 'SELECT * FROM french;
    $where = false;
    foreach ($expected as $var) {
    if (isset($_GET[$var]) && !empty($_GET[$var])) {
    if ($where) {
    $query_search .= ' AND ';
    } else {
    $query_search .= ' WHERE ';
    $where = true;
    $query_search .= $var . ' = '. GetSQLValueString($_GET[$var], 'text');
    to include things like searching multiple columns and IF NULL:
    SELECT * from MyTable where (MyCol1 = %s or MyCol1 Is Null) AND (MyCol2 = %s or MyCol2 Is Null)
    Where on earth does it go?
    Thanks
    Brian

    My goal is to have a search form and results combination that:
    1) allows the user to ignore any of the page’s existing search fields that
    they don’t need, (to search with empty form fields);
    2) to use whichever search form fields they choose to use even if the
    Registrant for whom they are searching did not insert that information when
    they registered, (they are filled in the search form but empty in the
    database table);
    3) and to permit some of the seach fields to search multiple columns, for
    example the search form field ‘sonsName’ would look for that information in
    three different database table colums, (sonsName1, sonsName2 etc.).
    You’ve given me code that permits 1) above to work beautifully. You’ve also
    sent along code that should let me accomplish the other two, and though I’ve
    been able to recreate below what I want the multiple search column to do, I
    can get neither the multiple column nor the IS NULL sections to work in the
    code you sent most recently.
    How do I take something like this:
    $colname_rsSearch = "-1";
    if (isset($_POST['first_name_now'])) {
      $colname_rsSearch = $_POST['first_name_now'];
    $colname2_rsSearch = "-1";
    if (isset($_POST['last_name_now'])) {
      $colname2_rsSearch = $_POST['last_name_now'];
    $colname3_rsSearch = "-1";
    if (isset($_POST['sonsName'])) {
      $colname3_rsSearch = $_POST['sonsName'];
    mysql_select_db($database_connStr_Milo_db, $connStr_Milo_db);
    $query_rsSearch = sprintf("SELECT milo.first_name_now, milo.last_name_now,
    milo.ws_number, milo.ws_number_3, milo.ws_number_4 FROM milo WHERE
    milo.first_name_now = %s AND milo.last_name_now = %s AND (milo.sonsName1 =
    %s) ||  (milo.sonsName2 = %s) || (milo.sonsName3 = %s)",
    GetSQLValueString($colname_rsSearch,
    "text"),GetSQLValueString($colname2_rsSearch,
    "text"),GetSQLValueString($colname3_rsSearch,
    "text"),GetSQLValueString($colname3_rsSearch,
    "text"),GetSQLValueString($colname3_rsSearch, "text"));
    $rsSearch = mysql_query($query_rsSearch, $connStr_Milo_db) or
    die(mysql_error());
    $row_rsSearch = mysql_fetch_assoc($rsSearch);
    $totalRows_rsSearch = mysql_num_rows($rsSearch);
    ?> (I’ve excluded the IS NULL part from my example, but need it in the final
    version)
    …and make it work using your code below (which permits someone to search
    with empty form fields, but does not yet enlighten me on what to group (with
    parenthesis) to make the code execute the multiple column search and the IS
    NULL parts of the search.
    mysql_select_db($database_connStr_Milo_db, $connStr_Milo_db);
    $expected = array('first_name_now', 'last_name_now', sonsName'
    $query_search = 'SELECT milo.first_name_now, milo.last_name_now,
    milo.ws_number, milo.ws_number_3, milo.ws_number_4  FROM milo';
    $where = false;
    foreach ($expected as $var) {
      if (isset($_POST[$var]) && !empty($_POST[$var])) {
        if ($where) {
          $query_search .= ' AND ';
        } else {
          $query_search .= ' WHERE ';
          $where = true;
      $query_search .= '(' . $var . ' = '. GetSQLValueString($_POST[$var],
    'text') .
      ' OR ' . $var . ' IS NULL)';
    $search = mysql_query($query_search, $connStr_Milo_db) or
    die(mysql_error());
    $row_search = mysql_fetch_assoc($search);
    $totalRows_search = mysql_num_rows($search);
    As always, thank you.

  • How to control a WHERE CLAUSE

    I am converting our BO Universe to OBIEE. There exist in the Universe an object which select COUNT(DISTINCT inventory_item_id) and has a WHERE CLAUSE that gives a date range.
    Going to OBIEE, how can I apply this WHERE CLAUSE to the object only? I can't find a place where to set this up. What I found was the WHERE CLAUSE box in the content tab of the table source. I wouldn't like to place it here because this WHERE CLAUSE should only fire when this object is selected by the user in his report.
    I would appreciate your help very much.
    Thank you.

    Hi,
    I created a report filter instead and saved it. I noticed one thing when I tested this. It took a while for the report to be generated. Is there a way I could do improve on the performance? This is what I placed in the report filter:
    CURRENT_DATE >= IFNULL("- Price List Lines"."Item Start Date" , CURRENT_DATE ) AND CURRENT_DATE < IFNULL("- Price List Lines"."Item End Date", TIMESTAMPADD( SQL_TSI_DAY , CURRENT_DATE , 1))
    Thank you.

  • Dynamically setting where clause parameter before the page load

    Hi Experts,
    I do have the following requirement.
    I am working on jsf page in ADF10.1.3.3. I have a View Object which displays the results on the screen. Can someone provide me some example where I can dynamically set the where clause parameter to my Query in VO before the Page Load happens(By Overriding the Prepare Model) and display results on screen.
    Thanks

    Hi,
    Thanks for yor advice.
    I need to write the method in Prepare Model method when the page loads and not in AM.
    Here in the page there is no action as such.
    On the Page load we need to directly set the Where Clause on the VO.
    Provide me some examples if any.
    Thanks

  • Adding filter conditions dynamically in WHERE clause -dynamic SQL help

    Here I have a simple condition but very complicated query. Basically, I have to put a filter condition in my where clause. "Location" comes to the stored procedure as parameter. Plus there are other parameters as well.
    If location = "all", I can run the query simply and get the result. But when Location = "CA", which is just a subset of "ALL" then I am having hard time putting one -- AND statement in WHERE clause.
    This query is designed for location = 'ALL'
    open cv for
    'Select col1, col2, col3, Col4
    from t1, t2, t3
    WHERE condition1
    AND condition2
    AND condition3'
    AND location = location_id --- This should only run if location IS NOT ALL
    I have written a dynamic query but it doesn't work for that part. Any ideas will be appreciated. Thanks,

    From what I understood
    If location = 'ALL' then
    fetch all the records
    Else
    add extra filter location_id = <supplied location id>
    End If
    If this is the condition the following logic should solve your issue.
    open cv for
    'Select col1, col2, col3, Col4
    from t1, t2, t3
    WHERE condition1
    AND condition2
    AND condition3'
    AND ((location_id = location_id and location = 'ALL') or (location_id = location))Regards
    Raj

Maybe you are looking for

  • Open order -report

    Hi, i'm trying to create a query that gives open qty. suppose in sales order line item 1      100        --delivered -50     -balance is 50      line item 2      200        -not delivered      -balance is 200    i've tried creating query using table

  • Places not working properly

    I am starting a new iPhoto library on a new iMac. I've never had this issue on my other Mac's but places takes forever to locate (I've used this a lot before with no problem). Just a spinning gear. The pin won't drop and where there is a pin, I canno

  • File structure and Multi-user access/control

    Hi All Currently evaluating RH. Our plan is to use RH HTML with RoboServer and either SourceSafe or Team Foundation for source control. We will be producing the "printed" manual (PDF) and publishing online help (hopefully html via RH server) from the

  • I can open RAW files from my camera in photoshop cs5, but they dont save properly after editing

    I can open RAW files from my camera in photoshop, but then after I have edited, i save as .raw, and open up the newly saved file and it just comes up as a grey messed up picture.  What am I doing wrong?

  • Photoshop cs5 lighting filter

    Hi! the lighting filter doesn't appear in my "filter", how i can download it and where? Avec la version cs5, je n'ai plus l'effet éclairage dans Filtre>rendu.. où est-ce que je pourrai télécharger ce filtre ou est-ce qu'il y aurait une sorte de rempl