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.

Similar Messages

  • How to set dynamic where clause in ADF?

    Hi,
    I have a View object called BillInfoVO. This has
    all the information about who created the request, the time , status etc.,
    I need to display this VO in a jsp. But before I display, i need to fileter this
    VO results with different where clauses according to the role of the user.
    For example, if the role is admin, then
    where clause should be 'status = 'Completed, and created by = 'Current user'
    If the role is requestor, then
    the where clause should be
    sales manager id = 'Current user' and
    Status != Complete etc.,
    Could any one please let me know how I can
    dynamically set the where clause to filter the appropirate
    result row set in the jsp?
    Your help will be greatly appreciated.
    Thanks,
    venki

    You'll create a service method in your AM that will use the setWhereClause method of a viewobject.
    Then you'll expose it as a client method.
    Then you'll drag it from your data-control onto a button in your JSF page that will call your page for the query.
    More about service methods here:
    http://download.oracle.com/docs/html/B25947_01/bcservices003.htm#sm0206
    http://download.oracle.com/docs/html/B25947_01/bcquerying008.htm#sthref286

  • 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

  • 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

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

  • How to set dynamic WHERE clause to VO from backingBean?

    Hi,
    Can any one let me know the best way to add the dynamic WHERE clause in to VO query.
    I have created AM (with AMImpl.java) & VO (with VOImpl.java & VORowImpl.java) in my model project. I suppose to set the WHERE condition at runtime while the user click the search button. I am handling the user button click at UI layer backingBean. From the backing bean I could able to get the objct of the VO and set the where clause by below code.
            ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings.UserSearchVO1Iterator}", Object.class);
            DCIteratorBinding dcIter = (DCIteratorBinding)valueExp.getValue(elContext);
            ViewObject userSearchVO = dcIter.getViewObject();
            userSearchVO.setWhereClause("lower(usr_login) LIKE ':1' and usr_udf_suid like ':2' ");
            userSearchVO.executeQuery();But as I fear this is not the right way to do it. So I am creating the cutom method inside the VOImpl.java and triggring that method by creating one more cutom method in AMImpl.java. But I dont know how to invoke this AM method from backingBean.
    AMImpl method
    public void initDetails()
            UserSearchVOImpl vo = getUserSearchVO1();
            vo.initQuery();
    VOImpl method
        public void initQuery()
            setWhereClause("lower(usr_login) LIKE 'a%' and usr_udf_suid like '%1144%'");
            executeQuery();
        }Can any one guide me which is the best way to set the where clause to VO? How to call the AM method from backingBean?
    Thanks
    kln

    i am new to oracle 11g i writing a stored procedure in which i have made use of case in where clause to pass my parameter value v_toStoreID
    i have googled a lot regarding that i found that to use case in where clause it should be like this
    where
    case  column_value
    when 0
    then value1
    else
    value2
    end
    this my query
    SELECT ITMID as ItemId,
    NVL(OrderDtl.PackageID, 0) PackageId,
    OrderDtl.OrdDtlID,
    (CASE NVL(OrderDtl.PackageID, 0)
    WHEN 0
    THEN 1
    ELSE 0
    END) as PackageFlag,
    ivitem.Code ItemCode,
    ivitem.ITMNAME AS itemName,
    IvPatientIssueMst.IssueNo Issue_No,
    to_char(Issuedate, 'DD/MM/YYYY') IssueDate,
    OrderDtl.OrdQty,
    NVL(OrderDtl.AllocationID, 0) Package,
    OrderDtl.ServiceAmount MRP
    FROM IvPatientIssueMst
    JOIN OrderMst
    ON IvPatientIssueMst.OrderId = OrderMst.OrdId
    JOIN OrderDtl
    ON OrderDtl.OrdID = OrderMst.OrdId
    JOIN ivitem
    ON ivitem.ITMID = OrderDtl.DrugId
    LEFT JOIN IVPatientIndentMst
    ON IVPatientIndentMst.IndentID = IvPatientIssueMst.IndentId
    WHERE OrderMst.OrdVisitID = 395899
    AND
    *(CASE IvPatientIssueMst.StoreId*
    when NVL(IvPatientIssueMst.StoreId, 0)=0
    THEN v_toStoreID
    ELSE  IVPatientIndentMst.ToStoreID
    END)
    ORDER BY ivitem.ITMNAME;
    it is not working please someone help

  • How to include dynamic where clause

    hai i want to write the dyanamic where clause to my select statments can any one suggest me how to do it
    regards
    afzak

    Hi Afzal,
    REPORT demo_select_dynamic_conditions .
    DATA: cond(72) TYPE c,
          itab LIKE TABLE OF cond.
    PARAMETERS: city1(10) TYPE c, city2(10) TYPE c.
    DATA wa TYPE spfli-cityfrom.
    CONCATENATE 'CITYFROM = ''' city1 '''' INTO cond.
    APPEND cond TO itab.
    CONCATENATE 'OR CITYFROM = ''' city2 '''' INTO cond.
    APPEND cond TO itab.
    CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO cond.
    APPEND cond TO itab.
    LOOP AT itab INTO cond.
      WRITE cond.
    ENDLOOP.
    SKIP.
    SELECT  cityfrom
      INTO  wa
      FROM  spfli
      WHERE (itab).
      WRITE / wa.
    ENDSELECT.
    Thanks & Regards,
    Sai

  • How to create dynamic where clause instead of pragmatically

    Hi,
    I'm using Jdev 11.1.2.2.0 and my requirement to create a two fields with search button to fetch data as adf table. User need to enter either of the field value and click search button to see his data.
    So I created a sql query based view object with 2 bind variables (which are input params) & 2 view criteria (to create dynamically where clause) and then drag on to the page by ExecuteWithParams operation from data controls but couldnt work.
    If anyone have idea to build dynamically please let me know.
    Amar

    User need to enter either of the field value and click search button to see his data.User need to enter either of the field value and click search button to see his data.
    Hi Amar,
    Is your requirement, creating a query panel with table??
    Drag and drop the view criteria(Application Navigator>DataControls> AppModule >NamedCriteria> ViewCriteriaName ) onto the page.
    In the context menu, select Query->ADFQueryPanel With Table.. That brings your necessary two columns and Search field with data represented as a table.
    Harsha
    Edited by: Harsha049 on Nov 28, 2012 3:51 PM

  • How to avoid repeat where clause in oracle sql

    Hi,
    Please find my query below, I need a help to avoid duplication of **where** clause in my query.
    In my below query, **JOIN** condition is same for both the queries and **WHERE** condition also same except this clause "and code.code_name="transaction_1"
    In **IF ** condition only credit and debit is swapped on both queries, due to this **Credit and Debit** and this where clause "and code.code_name="transaction_1" I am duplicating the query. Can you please give some solution to avoid this duplication. I am using oracle 11g
    select DAY as business_date,sum(amount) as AMOUNT, type_amnt as amount_type,test_code as code_seg
    from
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'credit'
    ELSE 'debit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_1"
    UNION ALL
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'debit'
    ELSE 'credit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_2"
    group by DAY, test_code,type_amnt
    Thanks

    user10624672 wrote:
    Hi,
    Please find my query below, I need a help to avoid duplication of **where** clause in my query.
    In my below query, **JOIN** condition is same for both the queries and **WHERE** condition also same except this clause "and code.code_name="transaction_1"
    In **IF ** condition only credit and debit is swapped on both queries, due to this **Credit and Debit** and this where clause "and code.code_name="transaction_1" I am duplicating the query. Can you please give some solution to avoid this duplication. I am using oracle 11g
    select DAY as business_date,sum(amount) as AMOUNT, type_amnt as amount_type,test_code as code_seg
    from
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'credit'
    ELSE 'debit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_1"
    UNION ALL
    select table1_alias.date as DAY,code.code_numb as test_code,
    CASE
    WHEN qnty_item > 0 THEN 'debit'
    ELSE 'credit'
    END as type_amnt,
    "25.55" as amount
    from
    code_table code,
    table1 table1_alias
    join table2 table2_alias on table1_alias.id = table2_alias.id
    where
    table1_alias.state="OK"
    and table1_alias.type="R"
    and code.code_type="Movie"
    and code.code_name="transaction_2"
    group by DAY, test_code,type_amnt
    ThanksA very brief glance and it looks to me like the only difference between the 2 queries are
    and code.code_name="transaction_1"In the first portion and
    and code.code_name="transaction_2"So if that's all that is difference, you'd just want to use a single query (no union's) with
    and code.code_name in ('transaction_1', 'transaction_2')Cheers,

  • How to retrieve the 'Where Clause' text?

    Hello all,
    I have created a package to retrieve all the DML's executed against the database for the day, for a particular user. DBMS_LOGMNR package was used to retrieve DMLs. But the DMLs retrieved have their 'WHERE' clause text converted to ROWID's. I need to find out the 'WHERE' clause with the parameters.
    I tried retrieving values from the v$sql views, but that information is cryptic and very volatile.
    Is there a way to retrieve the 'Where' clause? If not, is there a way to retrieve the 'WHERE' clause information using a trigger against the corresponding table.
    I am desparately lookin'for a solution. Hope someone out there can help me out.
    Regards,
    Prabu Raghav.

    Hi Andrew,
    Thanks for the suggestion.
    I am using Oracle 8i not 9i.FGA using DBMS_RLS let's me add policies and retrieve all other information about a user except the SQL statement that's executed by the user.
    I want to retrieve the Current sql statement executed against the table by a particular user and record it.
    Any suggestions?
    Regards,
    Prabu Raghav.

  • How to construct the where clause for a nested xml target file

    Post Author: jlpete72
    CA Forum: Data Integration
    I'm having some problems getting the desired results creating a multi-level nested xml file.  Specifically, it does not seem that the where clause in the child schemas respects values from parent schemas.  I'm sure I'm constructing something incorrectly, but am running out of ideas. 
    I am working with the classic company/order/line hierarchy and there are three levels of output schemas in my target xml file, one for company, order header and order line information.
    For testing, I have hardcoded a restriction at the order header line to deal with only one order.  But unless I hardcode values into the where clause at the order line level of the schema, all values are returned for orders belonging to the company defined in the company level.
    I'm trying a where clause at the order line level similar to:
    order_line.customer = order_header.customer and order_line.order_num = order_header.order_num
    If the customer has more than one order in the data file, then all orders for that customer are placed in the detail for the order header.  Only if I hard code the order number in the where clause do I get only the lines for the order specified in the header section.  Not very practical. 
    What am I missing?

    An External Parsed Entity could be used to reference a schema.
    In your DTD:
    <!ENTITY datamodules SYSTEM "file:///c:/Datamodules/Datamodules.xsd">
    Refer the external entity in xml document:
    <datamodules>&datamodules;</datamodules>

  • 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

  • How to use a where clause in an inner query

    String approv="pend"
     query = "Select Eno From EmpLeave Where  Status_approval='"+approv+"' and Eno in (Select Eno from EmpLeave  group by Eno having count(Eno)>1)";
    bt in the result even the rows without "pend" is also displayed...
    can sumone plzz tell me where should i put my where clause exactly in the above query

    i do have multiple records with status approval as "pend"....
    Try the below:
    query = "Select Eno From EmpLeave Where  Status_approval='"+approv+"' 
    and Eno in (Select Eno from EmpLeave  group by Eno having count(distinct status_approval)>1)";

Maybe you are looking for