Query based on Condition

Hi,
I have a select list based on the select list i need to generate the report
if businees_unit = 'a'
select emp.name from employess_dep1
if business_unit = 'b'
select emp.name from employess_dep2
end if
please help me to correct the above
Thanks
Sudhir

Like..?
select emp.name from employess_dep1
where :businees_unit = 'a'
union all
select emp.name from employess_dep2
where :business_unit = 'b'                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Running Query Based on Condition

    Hi
    I want to run different query based on a condition. I am not able to execute the following query. is this the right way to run different query based on condition?
    SELECT * FROM (
    CASE WHEN (SELECT COUNT (*) from data1 where ID = 1 AND stype = 'A') > 0 THEN select * from data where ID = 1 AND stype = 'A'
    WHEN (SELECT COUNT (*) from data1 where ID = 1 AND stype = 'B') > 0 THEN select * from data where ID = 1 AND stype = 'B'
    WHEN (SELECT COUNT (*) from data1 where ID = 1 AND stype = 'C') > 0 THEN select * from data where ID = 1 AND stype = 'C'
    END
    ) as a;
    Edited by: user6016744 on 21 Apr, 2011 12:40 AM

    This works for us; hope it helps.
    CREATE OR REPLACE FUNCTION SCHEMA.GET_STEP_COST (loan_number_in in VARCHAR2, step_code_in in VARCHAR2 default null, ws_in in VARCHAR2 default null )
    RETURN VARCHAR2 IS retval  VARCHAR2 (50);
    /*passing in loan number and step code you need the cost for, will return the cost*/
    BEGIN
        CASE ws_in --depending on workstation in is the table select
        WHEN 'F' THEN
            EXECUTE IMMEDIATE 'SELECT '|| step_code_in ||' FROM CLAIMS_FCL_STEPS WHERE LOAN_NUMBER = '|| loan_number_in ||'' INTO retval;
        WHEN 'R' THEN
           EXECUTE IMMEDIATE 'SELECT '|| step_code_in ||' FROM CLAIMS_RS_STEPS  WHERE LOAN_NUMBER = '|| loan_number_in ||'' INTO retval;
        WHEN 'L' THEN
           EXECUTE IMMEDIATE 'SELECT '|| step_code_in ||' FROM CLAIMS_LM_STEPS  WHERE LOAN_NUMBER = '|| loan_number_in ||'' INTO retval;   
        ELSE
            retval := 0;
        END CASE;
      RETURN retval;
    END GET_STEP_COST;
    /

  • Return query based on condition

    I'm trying to create a report region that returns results based on which table the data is stored. I'm using the type SQL Query(PL/SQL function body returning SQL query). I do a select to the first set of tables if the data is not there then it will do a select on the other set of tables. Each query will work find alone. But one query will not work when I use the condition IF Else return query.
    Does anybody know how I can accomplish this?
    Here is the Query:
    declare
    v_cnt number;
    begin
    select count(*) into v_cnt from image_repo_images im, image_repo_lookup il
    where im.document_id_type = il.lookup_code
    and il.lookup_type = 'DOCUMENT_TYPE'
    and il.lookup_code = 1
    and im.document_id = :P1_FILE_DLN;
    if v_cnt > 0 then
    return 'select distinct il.meaning, im.document_id, im.system_entry_date,im.batch_type,im.document_id_type
    from image_repo_images im, image_repo_lookup il
    where im.document_id = :P1_FILE_DLN
    and im.document_id_type = il.lookup_code
    and il.lookup_type = ''DOCUMENT_TYPE''
    and il.lookup_code = 1;';
    else
    return 'select ''DLN'', dln, null e_date,null bt,null tp from income_tax_return_images where dln = :P1_FILE_DLN';
    end if;
    end;
    Looks rather straight forward to me.
    I get this error:
    report error:
    ORA-20001: Error fetching column value: ORA-01403: no data found
    Any help will be appreciated.

    Does this work for you:
    DECLARE
       v_cnt     NUMBER;
       v_query   VARCHAR2 (4000);
    BEGIN
       SELECT COUNT (*)
         INTO v_cnt
         FROM image_repo_images im, image_repo_lookup il
        WHERE im.document_id_type = il.lookup_code
          AND il.lookup_type = 'DOCUMENT_TYPE'
          AND il.lookup_code = 1
          AND im.document_id = :p1_file_dln;
       IF v_cnt > 0
       THEN
          v_query :=
                v_query
             || 'SELECT DISTINCT il.meaning, im.document_id,'
             || ' im.system_entry_date,im.batch_type,im.document_id_type'
             || ' FROM image_repo_images im, image_repo_lookup il'
             || ' WHERE im.document_id = :P1_FILE_DLN'
             || ' AND im.document_id_type = il.lookup_code'
             || ' AND il.lookup_type = ''DOCUMENT_TYPE'''
             || ' AND il.lookup_code = 1';
       ELSE
          v_query :=
                v_query
             || 'SELECT ''DLN'', dln, null e_date,null bt,null tp '
             || ' FROM income_tax_return_images WHERE dln = :P1_FILE_DLN';
       END IF;
       RETURN v_query;
    END;I think you have a semicolon too much at "...il.lookup_code = 1;"
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Manually execute report query based on condition

    Hi,
    I have 2 queries defined in report as follows:
    Q1) select ename,sal from emp where empno = :emp_no;
    Q1) select ename,sal from emp;
    Based on a specific condition I want to switch between the above 2 queries , based on which report ouput will be generated.
    Example:
    IF <condition is true >
    THEN
    Execute Q1;
    ELSE
    Execute Q2;
    END IF;
    How to do this?
    Thanks

    Also, you can use Ref Cursor query, especially for complicated conditions like :
    IF :FROM_NO IS NULL AND :TO_NO IS NULL THEN
    open temp_CHARACT for SELECT ACCT_CODE,
    ACCT_NAME,ACCT_LEVEL,GROUP_CODE,MAIN_ACCT,OPENING_BALANCE
    FROM CHARACT
    ORDER BY ACCT_CODE;     
    ELSIF :TO_NO IS NULL AND :FROM_NO IS NOT NULL THEN
    open temp_CHARACT for select ACCT_CODE,
    ACCT_NAME,ACCT_LEVEL,GROUP_CODE,MAIN_ACCT,OPENING_BALANCE
    FROM CHARACT
    WHERE ACCT_CODE=:FROM_NO
    ORDER BY ACCT_CODE;     
    ELSIF :TO_NO IS NOT NULL AND :FROM_NO IS NOT NULL THEN
              open temp_CHARACT for select ACCT_CODE, ACCT_NAME,ACCT_LEVEL,GROUP_CODE,MAIN_ACCT,OPENING_BALANCE
              FROM CHARACT
              WHERE ACCT_CODE BETWEEN :FROM_NO AND :TO_NO
              ORDER BY ACCT_CODE;               
    ELSIF :TO_NO IS NOT NULL AND :FROM_NO IS NULL THEN
    open temp_CHARACT for select ACCT_CODE, ACCT_NAME,ACCT_LEVEL,GROUP_CODE,MAIN_ACCT,OPENING_BALANCE
    FROM CHARACT
    WHERE ACCT_CODE<=:TO_NO
    ORDER BY ACCT_CODE;     
    END IF;
    Regards
    Mostafa

  • Constructing a Query based on condition

    Dear all,
    i have a table attendance, it have two types of records, 1 is PLANNED 2 is RELEASED.
    Dept_id *1* has two child sections. *2* and *3*.
    if the Data entry operator from Dept_id=1 is logon, he could see PLANNED & RELEASED (BOTH) attendance from Dept_id =1
    but
    he could only see those entries from his child departments which are RELEASED.
    How could we construct such a query?
    Regards

    Thank you dear,
    i have a table for Department
    create table departments (dept_id number primary key,
    dept_type char(1), ---- 1 for Department and 2 for Section (one department could have sections)
    dname varchar2(60),
    parent_dept number references departments(dept_id),
    location varchar2(60));
    create table attendance_header (att_date date,
    att_kind char(1), ------------1 for OFFICIAL and 2 for OVERTIME
    dept_sec_id number references departments(dept_id),
    status char(1), -------PLANNED or RELEASED
    is_holiday char(1),
    is_weekend char(1));
    alter table attendance_header add constraint pk_att_header primary key(att_date,att_kind,dept_sec_id);
    create table attendance_details (emp_id varchar2(4) references emp(emp_id),
    att_date date,
    att_kind char(1),
    dept_sec_id number references departments(dept_id),
    att_type_no varchar2(2) references attendance_types(att_type_no), --- late , absent etc
    duration number, ------ how much time he late
    transaction_invoker varchar2(50));
    these are the tables
    NOW, suppose we take 3 departments 1,2,3 . 1 is the head Department of 2 &3 sections.
    every section or department has its own manager.
    the department 1 manager could see the data of its own departments both PLANNED & RELAESED.
    BUT
    for the sections 2 and 3, HE (the department 1 manager) could see only the RELEASED Data.
    i want a single query which is issued by the department 1 manager for this purpose.
    thanks and regards.
    Edited by: Muhammad on Mar 31, 2010 1:19 AM

  • Need different rows from single query based on condition

    Hi,
    I have a table with 100 rows that holds employees and their roles.
    I need to write a SQL(not a PL/SQL block) as below
    1. When employee with role 'VP' logs in, the query should return all the 100 rows.
    2. When employee with role 'MGR' logs in, the query should return only those rows whose MGR is the logged in employee.
    3. When employee with role 'SALE_EXEC' logs in, it should return single rows corresponding to this SALE_EXEC.
    My requirement here is to get these outputs from a single query.
    Can anyone please help me with this.
    Thanks,
    Vivek.

    use vpd
    New Policy Groups
    When adding the policy to a table, view, or synonym, you can use the DBMS_RLS.ADD_GROUPED_POLICY interface to specify the group to which the policy belongs. To specify which policies will be effective, you add a driving context using the DBMS_RLS.ADD_POLICY_CONTEXT interface. If the driving context returns an unknown policy group, then an error is returned.
    If the driving context is not defined, then all policies are executed. Likewise, if the driving context is NULL, then policies from all policy groups are enforced. In this way, an application accessing the data cannot bypass the security setup module (which sets up application context) to avoid any applicable policies.
    You can apply multiple driving contexts to the same table, view, or synonym, and each of them will be processed individually. In this way, you can configure multiple active sets of policies to be enforced.
    Consider, for example, a hosting company that hosts Benefits and Financial applications, which share some database objects. Both applications are striped for hosting using a SUBSCRIBER policy in the SYS_DEFAULT policy group. Data access is partitioned first by subscriber ID, then by whether the user is accessing the Benefits or Financial applications (determined by a driving context). Suppose that Company A, which uses the hosting services, wants to apply a custom policy which relates only to its own data access. You could add an additional driving context (such as COMPANY A SPECIAL) to ensure that the additional, special policy group is applied for data access for Company A only. You would not apply this under the SUBSCRIBER policy, because the policy relates only to Company A, and it is more efficient to segregate the basic hosting policy from other policies.
    How to Implement Policy Groups
    To create policy groups, the administrator must do two things:
    Set up a driving context to identify the effective policy group.
    Add policies to policy groups as required.
    The following example shows how to perform these tasks.
    Note:
    You need to set up the following data structures for the examples in this section to work:
    DROP USER finance CASCADE;
    CREATE USER finance IDENTIFIED BY welcome2;
    GRANT RESOURCE TO apps;
    DROP TABLE apps.benefit;
    CREATE TABLE apps.benefit (c NUMBER);
    Step 1: Set Up a Driving Context
    Begin by creating a namespace for the driving context. For example:
    CREATE CONTEXT appsctx USING apps.apps_security_init;
    Create the package that administers the driving context. For example:
    CREATE OR REPLACE PACKAGE apps.apps_security_init IS
    PROCEDURE setctx (policy_group VARCHAR2);
    END;
    CREATE OR REPLACE PACKAGE BODY apps.apps_security_init AS
    PROCEDURE setctx ( policy_group varchar2 ) IS
    BEGIN
    REM Do some checking to determine the current application.
    REM You can check the proxy if using the proxy authentication feature.
    REM Then set the context to indicate the current application.
    DBMS_SESSION.SET_CONTEXT('APPSCTX','ACTIVE_APPS', policy_group);
    END;
    END;
    Define the driving context for the table APPS.BENEFIT.
    BEGIN
    DBMS_RLS.ADD_POLICY_CONTEXT('apps','benefit','APPSCTX','ACTIVE_APPS');
    END;
    Step 2: Add a Policy to the Default Policy Group.
    Create a security function to return a predicate to divide the data by company.
    CREATE OR REPLACE FUNCTION by_company (sch varchar2, tab varchar2)
    RETURN VARCHAR2 AS
    BEGIN
    RETURN 'COMPANY = SYS_CONTEXT(''ID'',''MY_COMPANY'')';
    END;
    Because policies in SYS_DEFAULT are always executed (except for SYS, or users with the EXEMPT ACCESS POLICY system privilege), this security policy (named SECURITY_BY_COMPANY), will always be enforced regardless of the application running. This achieves the universal security requirement on the table: namely, that each company should see its own data regardless of the application that is running. The function APPS.APPS_SECURITY_INIT.BY_COMPANY returns the predicate to make sure that users can only see data related to their own company:
    BEGIN
    DBMS_RLS.ADD_GROUPED_POLICY('apps','benefit','SYS_DEFAULT',
    'security_by_company',
    'apps','by_company');
    END;
    Step 3: Add a Policy to the HR Policy Group
    First, create the HR group:
    CREATE OR REPLACE FUNCTION hr.security_policy
    RETURN VARCHAR2
    AS
    BEGIN
    RETURN 'SYS_CONTEXT(''ID'',''TITLE'') = ''MANAGER'' ';
    END;
    The following creates the policy group and adds a policy named HR_SECURITY to the HR policy group. The function HR.SECURITY_POLICY returns the predicate to enforce security on the APPS.BENEFIT table:
    BEGIN
    DBMS_RLS.CREATE_POLICY_GROUP('apps','benefit','HR');
    DBMS_RLS.ADD_GROUPED_POLICY('apps','benefit','HR',
    'hr_security','hr','security_policy');
    END;
    Step 4: Add a Policy to the FINANCE Policy Group
    Create the FINANCE policy:
    CREATE OR REPLACE FUNCTION finance.security_policy
    RETURN VARCHAR2
    AS
    BEGIN
    RETURN ('SYS_CONTEXT(''ID'',''DEPT'') = ''FINANCE'' ');
    END;
    Create a policy group named FINANCE and add the FINANCE policy to the FINANCE group:
    BEGIN
    DBMS_RLS.CREATE_POLICY_GROUP('apps','benefit','FINANCE');
    DBMS_RLS.ADD_GROUPED_POLICY('apps','benefit','FINANCE',
    'finance_security','finance', 'security_policy');
    END;
    As a result, when the database is accessed, the application initializes the driving context after authentication. For example, with the HR application:
    execute apps.security_init.setctx('HR');
    Validating the Application Used to Connect to the Database
    The package implementing the driving context must correctly validate the application that is being used to connect to the database. Although the database always checks the call stack to ensure that the package implementing the driving context sets context attributes, inadequate validation can still occur within the package.
    For example, in applications where database users or enterprise users are known to the database, the user needs the EXECUTE privilege on the package that sets the driving context. Consider a user who knows that:
    The BENEFITS application allows more liberal access than the HR application
    The setctx procedure (which sets the correct policy group within the driving context) does not perform any validation to determine which application is actually connecting. That is, the procedure does not check either the IP address of the incoming connection (for a three-tier system) or the proxy_user attribute of the user session.
    Such a user could pass to the driving context package an argument setting the context to the more liberal BENEFITS policy group, and then access the HR application instead. Because the setctx does no further validation of the application, this user bypasses the normally more restrictive HR security policy.
    By contrast, if you implement proxy authentication with VPD, then you can determine the identity of the middle tier (and the application) that is actually connecting to the database on behalf of a user. In this way, the correct policy will be applied for each application to mediate data access.
    For example, a developer using the proxy authentication feature could determine that the application (the middle tier) connecting to the database is HRAPPSERVER. The package that implements the driving context can thus verify whether the proxy_user in the user session is HRAPPSERVER. If so, then it can set the driving context to use the HR policy group. If proxy_user is not HRAPPSERVER, then it can disallow access.
    In this case, when the following query is executed
    SELECT * FROM APPS.BENEFIT;
    Oracle Database picks up policies from the default policy group (SYS_DEFAULT) and active namespace HR. The query is internally rewritten as follows:
    SELECT * FROM APPS.BENEFIT WHERE COMPANY = SYS_CONTEXT('ID','MY_COMPANY') and SYS_CONTEXT('ID','TITLE') = 'MANAGER';
    How to Add a Policy to a Table, View, or Synonym
    The DBMS_RLS package enables you to administer security policies by using its procedures for adding, enabling, refreshing, or dropping policies, policy groups, or application contexts. You need to specify the table, view, or synonym to which you are adding a policy, as well as the data pertinent to that policy, such as the policy name. Such data also includes names for the policy group and the function implementing the policy. You can also specify the types of statements the policy controls (SELECT, INSERT, UPDATE, DELETE, CREATE INDEX, or ALTER INDEX).
    for more you can refer to
    http://download-west.oracle.com/docs/cd/B19306_01/network.102/b14266/apdvcntx.htm

  • Select Query Based on date condition

    Hi ,
    Is it Possible.
    i want to run select query based on date condition.
    Eg...
    if the date between 01-jan-01 and 01-jan-05 then
    select * from table1;
    if the date between 02-jan-05 and 01-jan-08 then
    select * from table2;
    Becaz i have data in 2 diffrent tables , based on the date condition i wnt to run the select statement to diffrent tables.
    i dont want plsql here Just SQL needed.
    thanks,
    -R
    Edited by: infant_raj on May 5, 2009 11:48 PM

    Helo Kanish,
    this is not the one i was asking..
    wht i mean was .
    i use bind variable to get date while running the select statement , once i get the date then i want to choose any one of the table to run select query.
    EG..
    select col1,col2 from table1 where date between only if 01-jan-01 and 01-jan-05;
    select col1,col2 from table2 where date between only if 02-jan-05 and 01-jan-08;
    Run any one of the two . not all
    thanks,
    _raj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Query performance based on condition value

    Hi,
    I have a simple query which is actually on a view dwdb_dba.actl_partinfo_cust. Please see query bellow
    select * from dwdb_dba.actl_partinfo_cust WHERE insertdatetime=(select max(insertdatetime)
    from dwdb_dba.actl_partinfo_cust Where system_source='UTS') AND SUPPLIERID='CG1' and Custdevice in ('BT-M2789-C')This query is taking very very long time to return (around 30 records) but if i u
    Here if i change the condition "AND SUPPLIERID='CG1'" to "AND SUPPLIERID='DUMMY'", it returns within 3 seconds. Execution plan is same for both then why one query taking too much time and other returning so fast and how can i tune the query against the condition AND SUPPLIERID='CG1' so that it can also return within 3 seconds.
    I actualy dont understand the behaviour
    PLAN_TABLE_OUTPUT
    Plan hash value: 3622663398
    | Id  | Operation                       | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |                             |    10 | 42790 |   152K  (6)| 00:00:59 |
    |*  1 |  VIEW                           | ACTL_PARTINFO_CUST          |    10 | 42790 | 59972   (4)| 00:00:23 |
    |   2 |   UNION-ALL                     |                             |       |       |            |       |
    |*  3 |    TABLE ACCESS BY INDEX ROWID  | ACTL_PARTINFO_CUST_UTS      |     9 |  3429 | 59968   (4)| 00:00:23 |
    |*  4 |     INDEX RANGE SCAN            | ACTL_PART_CUST_UTS_IDX3     |   420K|       |  1462  (11)| 00:00:01 |
    |*  5 |    TABLE ACCESS BY INDEX ROWID  | ACTL_PARTINFO_CUST_PROMIS_4 |     1 |   311 |     4   (0)| 00:00:01 |
    |*  6 |     INDEX RANGE SCAN            | ACTL_PARTINFO_CUST_4_IDX1   |     1 |       |     3   (0)| 00:00:01 |
    |   7 |   SORT AGGREGATE                |                             |     1 |    14 |            |       |
    |   8 |    VIEW                         | ACTL_PARTINFO_CUST          |  1363K|    18M| 92040   (8)| 00:00:36 |
    |   9 |     UNION-ALL                   |                             |       |       |            |       |
    |* 10 |      TABLE ACCESS BY INDEX ROWID| ACTL_PARTINFO_CUST_UTS      |  1363K|    33M| 92036   (8)| 00:00:36 |
    |* 11 |       INDEX RANGE SCAN          | ACTL_PART_CUST_UTS_IDX1     |  1481K|       |  5528  (10)| 00:00:03 |
    |* 12 |      TABLE ACCESS BY INDEX ROWID| ACTL_PARTINFO_CUST_PROMIS_4 |     1 |    15 |     4   (0)| 00:00:01 |
    |* 13 |       INDEX RANGE SCAN          | ACTL_PARTINFO_CUST_4_IDX1   |     1 |       |     3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------------Thanks

    Salman Qureshi wrote:
    This query is taking very very long time to return (around 30 records) but if i u
    Here if i change the condition "AND SUPPLIERID='CG1'" to "AND SUPPLIERID='DUMMY'", it returns within 3 seconds.
    My developer has changed the code of the view which was involved and not it is working fine but still i m curious to know that what could be the reason of this. Same execution plan but only condition value is different. One value returns some rows but returns within few seconds and other condition also returns a few rows but may hours.Salman,
    A bit more details would help diagnose the root cause.
    If you are still interested in diagnosing the root cause, you may want to provide complete EXPLAIN PLAN output, along with predicate section. If you are on 10g, you may want to provide the output of DBMS_XPLAN.DISPLAY_CURSOR which will show the actual plan used along with actual number of records generated by each step in the execution plan.
    It is possible that SUPPLIERID column data is skewed so that there are less records in table for the value 'DUMMY' but much more number of records for the value 'CG1'. This predicate combined with the other predicate on CUSTDEVICE column may have been resulting in similar number of rows the final query returns.
    It is possible that the predicate on CUSTDEVICE is being applied at different stage in the plan than the predicate on SUPPLIERID column.
    Edited by: user503699 on Aug 3, 2010 3:11 PM

  • POP UP  inside a report: conditional query based on other col el. values

    HI to all,
    i've a really simple question: is there a way inside a pop up in a report, to refer to other columns value (of the same row)?
    I'm giving my example:
    i've a table called CNT_VAL_SEG_DEMO
    id
    des
    value
    value have to be a pop up LOV, query based:
    the pseudo sql code is this:
    SELECT DISTINCT VALUE V1 , VALUE V2 FROM CNT_VAL_SEG_DEMO WHERE
    des=<pseudo code>#DES#<pseudo code>.
    What should i use instead of #DES#
    Hope that is clear enough
    thanx a lot

    Hi,
    i think i've found the solution on htmldb studio.
    Doesn't matter.
    However for pointing who's reading
    to the right direction:
    http://htmldb.oracle.com/pls/otn/f?p=18326:54:3063779097888583::::P54_ID:1282
    Tips and tricks: Simulating a correlated sub report in Lov
    Thanx a lot
    Message was edited by:
    Marcello Nocito

  • Include Button that executes PL/SQL procedure to SQL query based region

    I would like to add two columns to a SQL query region.
    These columns would not be sourced from the query, but rather would be used to execute a PL/SQL procedure.
    For example, I would like to have a manager approve or deny adding an additional employee to the department.
    There would be one button for APPROVE. And, one button for DENY.
    The PL/SQL procedure would execute to perform the required DML based upon the selected action (either APPROVE or DENY).
    A sample output would look like this:
    <APPROVE>, <DENY>, John Doe, Accountant
    <APPROVE>, <DENY>, Jane Doe, Accountant
    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?
    Thanks!
    -Reid

    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?Conditional page item? You can associate processes with buttons on a page

  • How to give color to the display of keyfigure based on condition using exception.

    Dear Friends.
       I am trying to color "BAD3" in exception based on condition but my problem is in exception I can have only formula variable to compare the value, How to assign a value to formula variable in BEx Query designer.
    What I am trying to do is :
       in Query designer :
       I have PO Quantity and Delivered Quantity. 
      if PO Qnantity > Delivered Quantity
        then Delivered Quantity field should be colored as "BAD3" in exception.
    but here proble is in exception
      I have alert level , operator, and  value fields for Delivered Quantity keyfigure ( Under definition tab - Exception is defined on = Delivered Quantity ).
    but for value field I dont have PO Quantity for that I have to supply one formula variable,
    When I created a forumula  and did this way
    FV_PO_QUANTITY = PO_QUANTITY formula editor throws errors. I dont understand How to assign a value of key figure to formula variable and use it in EXceptions.
    Please help me How I can solve my problem
    I will greatly appreciate your any help.
    Thanking you
    Regards
    Naim

    Thank you so much for your replies,
      I did following way and it helped me to solve my issues.
      I created one formula and under formula I use boolean < funtion to compare the values.
    like following way.
    ( 'PO Quantity' > 'Delivered Quantity' ) * ( FV_PO_QNT + PO_QUANTITY')
    here fv_po_qnt is formula variable I supply that variable to exception and since I have the value in it.. it compares with Delievered Quantity value and colored the perticular cell.
    Thanks again for your replies
    Regards
    Naim

  • How to increase performanceof query based on Infoset?

    How to increase the performance of a query based on a Infoset?
    As per designing of query, all the necessary fields are placed where they are required.

    Hi  Akshara ,
    To improve performanceof query try to remove unnecessary characteristics, attributes, or key figures ,Superfluous conditions or variables .Large InfoCubes and Complex hierarchies .Variables populated by user exits
    For characteristics specify either variables or restrictions .
    You can create indexes on DSO and Aggregates on cubes (if any).
    Please go through the links :
    http://help.sap.com/saphelp_crm40/helpdata/en/77/4a213cc534f20ae10000000a11402f/content.htm
    Re: Performance of query built on infoset
    Query performance issue - Infoset query
    Hope you will find this helpful.
    Regards,
    Jaya

  • Disc 4137 - query based on login?

    We have a sales table in Discoverer that we want to allow sales managers to access so they can define their own ad-hoc queries. However we only want them to be able to query based on sales attributed to them i.e. they can't query on other sales managers.
    I know I can build business areas for each sales manager and create a custom folder in each area with the sales manager pre-defined to limit queries but to simplify the maintenance I'd like to be able to limit the queries based on how the user logs into Discoverer. i.e. username 'ABC' logs in; view has logic to recognize 'ABC' as the username and automatically sets a condition to sales_manager='ABC'.
    Is something like this doable with Discoverer? I know we can get the username via forms but didn't know if Discoverer offered this functionality too.

    Actually, what's been said is correct for database EULs.
    However, for Apps-EULs, it is possible to determine the Oracle Apps user and/or the Oracle Apps responsibility that's presently logged in to Discoverer (requires an external routine to be registered but it's an Oracle one).
    Then, if an Apps-EUL, you can limit the folder in the EUL to that responsibility, etc. in the same fashion as stated for the DB-EUL.
    Note that some of the views in the database may indeed only show info for a particular apps user / responsibility, but these views are usually only the BIS views and if you look at the code to these views, it's obvious as one of the last lines will refer to a package such as: HR_Security_Pkg or GL_Security_Pkg.
    However, if you're going straight to an Oracle table and it's an Apps-EUL, then what I mentions works - done it many times now.

  • Dynamic filter on time characteristics on OLAP SAP BEX query based universe

    Dear all,
    I'm currently working on the integration between SAP NetWeaver BI 7.0 and SAP BusinessObjects XI 3.1 FP 1.5 via integration kit.
    I've built an OLAP universe on the top of a BW query based on a multiprovider that contains 10 infocubes.
    Everything works fine but I need to create a filter in the OLAP universe that allows to restrict data by current date (e.g. using TIME characteristic of Infocube such as 0CALDAY or 0CALMONTH). From that filter we could start creating other conditions to compare data to different time periods.
    I've already tried to use a SAP exit variable in  a BW query but this kind of object would restrict query data only by current date and for example it would be impossible to browse data by previous years (to bypass this problem we could use restricted key figures with different offsets but we have too many key figures in the query and the number of restrictions
    would rise exponentially). 
    In a relational DataBase we can do that using a "where condition" based on 'CURRENTDATE' (SQL DB2 syntax).
    Now, we need to apply the same logic but translated in MDX syntax. 
    Is it possible to enter a dynamic filter in the OLAP universe or just fixed or promt values ?
    Any advise?
    Thanks in advance.
    Best Regards.
    M.

    Hi Ingo,
    1) My question is: "How can I have to manage variable in BEX queries and in the UNIVERSE in order to obtain the maximum flexibility to create reports with measures on actual day (for example) without asking the user to promt a value ?"
    I want to use an unique BEX query to define an unique UNIVERSE. On this UNIVERSE I want to create many reports (actual day, previous day, and so on).
    If I restrict 0CALDAY with an EXIT variable then shall I be able to create a different restrictions on the same Universe based on 0CALDAY ?
    2) Another question is:
    Is it possible to insert an XML / MDX filter on the OLAP Universe with dynamic derivation of the system date ?
    For example:
    Instead of this:
    <FILTER KEY="[0FISCYEAR].[LEVEL01].[NAME]">
        <CONDITION OPERATORCONDITION="Equal">
            <CONSTANT CAPTION="Z12008"></CONSTANT>
        </CONDITION>
    </FILTER>
    Is it possible to insert a tag with a dynamic function to derive the system date ?
    Thanks in advance.
    Best Regards.

  • Display T - tru or F - false  based on condition

    Hello,
    Could you please let me know how to display T - true or F - False based on condition.
    I am only able to display 0 and 1 but i want F and T instead.
    thanks
    Gade.

    Hi,
    I donot think that it is possible simply with Query designer features. You better think about the Macros . The below thread can be considered as an example(mr. Deveshwar reply).
    Display Date as 00/00/0000 instead of # if date field is empty
    With rgds,
    Anil Kumar Sharma .P

Maybe you are looking for

  • After upgrading to lion my web server won't run

    after upgrading to lion my web server won't run

  • Table CUVV in 8.8

    Hi Experts, I want to know how this table being updated? 375     Send back to Dentist     0 378     BOX     0 378     CARTON     1 378     GRAMME     2 378     KILO     3 378     PACK     4 378     PIECE     5 391     11010300-AU-000-0000-0000     0

  • Lenovo Twist 230U - Hard Drive replacment​, how to get recovery disk

    I bought this laptop about a year ago from Staples, all of a sudden my hard drive started clickin and has now died.  I just want to replace the hard drive, but how do I get a valid install of Windows 8 for this? 

  • How to make a special accent on 's'

    This is not strictly a InDesign question, but this is the place to get the answers! I am busy with school books in 6 different african languages, and one of the characters needed is the letter "n" (in upper and lower case) with an accent that looks l

  • Trouble playing Music Videos on 8.1

    Music videos on iTunes (8.1) will only play audio even though Movies and TV Shows will display regularly on Quicktime (7.6). I've followed standard "If you can't play a video" iTunes Help instructions to no avail.