Using Keyfigures with selections in a query

Hi Experts,
I am designing a query which has the selection criteria as (Condition1) OR ( Condition2 and Condition3) and all the selection are for a single month. For this I have created a Structure and am using two selections.
I also need to display a SINGLE keyfigure which displays the number of records for the month. The problem that I am facing is, as soon as I hide the selections the Keyfigure values do not show up.
Any ideas.
Thanks
RB

Hi Vijay,
Though it should not make a difference whether the result values are suppressed or not because I am using selections in a structure but still I tried this and it did not work. Let me redefine my problem to ease the understanding of the logic.
select all sales order whose (priority is high) OR ( status is inprocess And owner = X)
For the above criteria I created one selection which had the restriction on Priority as high and the other selection has status as inprocess and Owner = X.
Now I do not want to show the selection criteria on the report so I have hidden both the selections.
I also want to display a keyfigure which counts the number of records.
The problem is If I hide the selections it does not display the number of records but If I show the selections then it does. I do not want to display the selections but still do want the number of records value to appear.
I hope this time I was more clear.
Thanks
RB

Similar Messages

  • Need help with select statement or query

    Not familiar with what to call it, but here is what i need...
    To give our analyst a better idea of warranty on some of our
    equipment, i
    would like to add to the page a column that displays if the
    device is still
    under warranty
    I currently capture the date the equipment was returned from
    repair, so what
    could i use within my select statement or query to display a
    warranty
    expiration date or display on the page...
    example :
    Returned from repair 10/20/2006 warranty expires on
    11/20/2006
    each equipment has different warranties, so i need a formula
    or something to
    say... device #1 has 60 day warranty ( so 10/20/2006 + 60days
    =
    12/19/2006 )
    I would imagine this to be a query
    Table 1 would contain the equipment type and warranty time
    Table 2 would contain the current status of the equipment
    Query would take the back from repair date + warranty =
    expiration date

    Simple. Join the two tables and create a derived column for
    the expiration date. The exact syntax is dependant on your DBMS, so
    check the manual for whichever you are using and look at the date
    functions. There will be a function that will allow you to add a
    number of date units (day, month, year, etc) to a date
    field.

  • Using like with select clause

    Hi experts,
    I have a problem where i feel i should catch filtered resultset on to my internal table and i feel using LIKE.
    But if i use LIKE '%AMIT%'
    will it store
    AMIT
    amit
    Amit  ie all possible combination irrespectin of any case ?
    Will it be case insenstive or not ?

    HI,
    using like in select is case sensitive.
    do like this for ignoring the case.
    TABLES:mara.
    SELECT * from mara.
      IF mara-matnr cp 'm*'.
        WRITE:/ mara-matnr.
      ENDIF.
    ENDSELECT.
    rgds,
    bharat.

  • Not able to use date with time in sql query

    Hi,
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id,b.creation_date
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between to_date('21-10-2013 9:19:48','DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    If I execute this query in toad it is giving me proper results.This query populates the results between the two date with time.
    But I am facing issue when I am using this query in the procedure. The procedure is as below.
    If I use the same query in the procedure I am getting wrong output.
    CREATE OR REPLACE procedure xx_prog_upd_annualized_amt(errbuf out varchar2, retcode out varchar2)
    as
    cursor c1 (l_date in varchar2)is
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between  to_date(l_date,'DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    v_date varchar2(100);
    v_total_days number;
    v_annualized_amount number;
    begin
    begin
    select max(fcr.actual_start_date) into v_date
    from fnd_concurrent_programs_vl fcp
    ,fnd_concurrent_requests fcr
    where fcp.concurrent_program_id = fcr.concurrent_program_id
    and fcp.user_concurrent_program_name like 'Renewed Annualized Amount Updation';
    exception
    when others then
    fnd_file.put_line(fnd_file.log,'Invalid date');
    end;
    fnd_file.put_line(fnd_file.output,v_date);
    fnd_file.put_line(fnd_file.output,sysdate);
    fnd_file.put_line(fnd_file.output,'***************Start of Program***************');
    fnd_file.put_line(fnd_file.output,'***************Hi***************');
    For i in c1(v_date) loop
    SELECT
             1
           + 30 * TRUNC (MONTHS_BETWEEN ( TO_DATE (i.end_date, 'DD-MON-YYYY'),  TO_DATE (i.start_date, 'DD-MON-YYYY')))
           + LEAST (EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')), 30)
           - LEAST (EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')), 30)
           + CASE
                WHEN EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')) < EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')) THEN 30
                ELSE 0
             END
              daysbetween into v_total_days
      FROM dual;
      fnd_file.put_line(fnd_file.output,i.contract_number);
      fnd_file.put_line(fnd_file.output,v_total_days);
      If v_total_days < 360 then
      v_annualized_amount := (360*i.price_negotiated)/v_total_days;
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = v_annualized_amount
      where cle_id = i.cle_id;
       fnd_file.put_line(fnd_file.output,v_annualized_amount);
        fnd_file.put_line(fnd_file.output,i.cle_id);
        elsif v_total_days >= 360 then
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = i.price_negotiated
      where cle_id = i.cle_id;
      end if;
    end loop;
    commit;
    fnd_file.put_line(fnd_file.output,'***************End of Program***************');
    null;
    end;

    SureshM wrote:
    Hi Purvesh,
    Apologize for not giving the sufficient information.
    max(fcr.actual_start_date) = here I am getting date with time (for eg :9/4/2012 6:47:49 PM)
    Datatype for this column is date.
    This actual start date I am storing in varchar2 variable and then converting this value to date with time.
    My requirement is to pick the rows between the two timestamps which I am unable to do in the procedure.
    Regards
    Suresh
    YOu are losing the Time information while fetching the data into a VARCHAR2 variable. change the datatype of v_date to DATE and get rid of the TO_DATE logic in cursor and simply use v_date variable.
    Message was edited by: PurveshK misread.

  • Function with select if statement query

    Hi,
    I want to use if condition in select statement in function.
    But i implemented in case too ,its taking more time to return the value while using case statement.
    My function is like this
    create or replace FUNCTION GET_CODE
    (pv_type IN table1.type%TYPE,
    pv_desc1 IN table2.type%TYPE,
    pv_desc2 IN table3.type%TYPE)
    RETURN varchar2(35 byte)
    IS
    V_ret_string varchar2(35 byte);
    BEGIN
    SELECT case when(table2.xxx like 'fff%') then 1
    when (table3.yyy like 'fff%') then 2
    when (table4.zzz like 'fff%') then 3
    else table1.aaa
    INTO V_ret_string
    FROM
    table1 a,table2 b,table3 c table4 d
    WHERE
    table1.column1=table2.column1
    and (table1.column2=table3.column1 or table1.column2=table4.column1) and
    UPPER(b.type) = UPPER(pv_type) and
    (UPPER(c.desc) = UPPER(pv_desc1) or UPPER(d.desc1) = UPPER(pv_desc2)) ;
    RETURN V_ret_string;
    END GET_TRANSACTION_CODE;
    Pls help me how to use if condition.
    Regards,
    Punitha

    936698 wrote:
    Hi,
    I want to use if condition in select statement in function.Oracle SQL SELECT statement does not support IF condition syntax. But what it does is CASE and DECODE. And CASE statement is sufficient to achieve what ever you want to do with IF condition.
    But i implemented in case too ,its taking more time to return the value while using case statement.So the issue is not with CASE its with the SELECT Statement. What you have to do is Isolate your SELECT statement and try to tune it for performance.
    To do that i would suggest you to read the folloing threads which could be of good use.
    {thread:id=501834} and {thread:id=863295}.
    >
    >
    My function is like this
    create or replace FUNCTION GET_CODE
    (pv_type IN table1.type%TYPE,
    pv_desc1 IN table2.type%TYPE,
    pv_desc2 IN table3.type%TYPE)
    RETURN varchar2(35 byte)
    IS
    V_ret_string varchar2(35 byte);
    BEGIN
    SELECT case when(table2.xxx like 'fff%') then 1
    when (table3.yyy like 'fff%') then 2
    when (table4.zzz like 'fff%') then 3
    else table1.aaa
    INTO V_ret_string
    FROM
    table1 a,table2 b,table3 c table4 d
    WHERE
    table1.column1=table2.column1
    and (table1.column2=table3.column1 or table1.column2=table4.column1) and
    UPPER(b.type) = UPPER(pv_type) and
    (UPPER(c.desc) = UPPER(pv_desc1) or UPPER(d.desc1) = UPPER(pv_desc2)) ;
    RETURN V_ret_string;
    END GET_TRANSACTION_CODE;When ever posting code please make sure the code is well formatted and you use the {noformat}{noformat} tag to preserve the format. An unformatted code is very hard to read.
    The usage of the tag is like this.
    <place your code here>\                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using conditions with SELECT

    I am trying to gather conditional data from a table based on data from another as shown below :
    SELECT NEW_ITEM.CD, CLIENT_DISCOUNT.SHOPPER_ID,
    If CLIENT_DISCOUNT.DISCOUNT<=NEW_ITEM.MAX_DISC then NEW_ITEM.BASE_PRICE*((100-CLIENT_DISCOUNT.DISCOUNT])/100)Else NEW_ITEM.BASE_PRICE*((100-NEW_ITEM.MAX_DISC)/100) AS CAT_PRICE
    End If
    FROM NEW_ITEM, CLIENT_DISCOUNT
    WHERE CLIENT_DISCOUNT.SHOPPER_ID='Ted';
    but i am getting the error "FROM is not where expected".
    So my questions are :
    1. If it is possible to put If ... Then ... Else inside a Select query and
    2. If yes, what is the correct syntax.
    Thank you in advance.

    You can use a CASE... END statement in SQL to achieve the desired result.
    Your query would look something like this :
    select n.cd, c.shopper_id, CASE WHEN c.discount <= n.max_disc THEN n.base_price*((100 - c.discount)/100)
    ELSE n.base_price*((100 - n.max_disc)/100)
    END as ItemPrice
    from new_item n , client_discount c where c.shopper_id='Ted'
    Ideally your query should have one more condition like n.itemId = c.itemId in the where clause to limit the
    query results otherwise it will result in a cartesain product.
    Chandar

  • Trying to use Spry with Select List

    I have a dataset that is static xml. .In the xml file I have
    a node called categoreis and then repeating node of store name,
    phone and address in that category. There are around 15 categories
    and a total of 100 stores with address and phone. I can create the
    select list and add the onchange event to tell Spry which row of
    data was selected in the drop down. I do not understand how to
    generate the detail region that shows the stores for that
    particular category. Any help would be appreciated.

    Always include the following information when asking a question:
    <ul>
    <li>Full APEX version</li>
    <li>Full DB/version/edition/host OS</li>
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)</li>
    <li>Browser(s) and version(s) used</li>
    <li>Theme</li>
    <li>Template(s)</li>
    <li>Region/item type(s)</li>
    </ul>
    taepodong wrote:
    Hi All,
    Bit at loss what i am doing wrong here. Trying to change a field (previously in textfield) to a drop down select list. All works except one. It looks like Multi-selector even though I set the type as Select List
    http://i.imgur.com/Hz7tP.png
    Got no idea what I have to do to change it to drop down. Many Thanks.If you are on apex 4.x, you might have set the Allow Multiple Selection to Yes
    Edit the select list item > Settings > set Allow Multi Selection to No
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/item_types001.htm#HTMDB28627

  • OPEN CURSOR using a WITH clause in the select query

    Hi,
    I am using Oracle 9i. I have a requirement where I have a REFCURSOR as an OUT parameter for my procedure. I have declared the TYPE and created the procedure.
    In the procedure, I am using OPEN <cursor_name> FOR <query>;
    Ideally this works in most of the cases that I have tried earlier. However, in the current case I am using a WITH clause in my query to get the results.
    I need help in understanding if the above mentioned syntax would not allow me to use the WITH clause in the query.

    What error do you get , seems to work ok for me on 10g
    SQL> begin
      2  open :cv for 'with x as (select * from emp)  select * from x';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> print :cv
         EMPNO
    ENAME
    JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7521
    WARD
    SALESMAN        7698 22-FEB-81       1250        500         30
          7566
    JONES
    MANAGER         7839 02-APR-81       2975                    20
         EMPNO

  • Constant Selection in BEx Query Designer on BI7

    Hi guys
    According to this blog <a href="/people/prakash.darji/blog/2006/09/19/the-hidden-secret-of-constant-selection Selection</a>, we can create constant selection on both Characteristics and Key figures. I understand how to do it with restricted key figures.
    Can anyone give me a step by step guide on how to create constant selection for a Characteristic in BEx Query Designer on BI7. I can't find options for 'constant selection'
    Or is this the same thing when you include or exclude values?
    Message was edited by:
            jimi ogun

    Thanks Krishna
    I am actually using a Multiprovider for my queries but business requirements mean I need to create joins.
    I am trying to avoid Infosets and I believe another way is to use the Constant Selection feature in Query Designer.
    Going back to my previous posting, I know how this is done with a restricted KF but I don't know how when it comes to characteristics.
    Can anyone help?

  • With clause in SQL query data model

    Hello!
    isn't it possible to use the with clause in sql query data models?
    for example following query:
    WITH
    a_test as (
    select dummy from dual
    select *
    from a_test
    brings up a "XML Parsing Error: no element found"-error...
    BR Paul

    I tried a slightly different query (see below) and the query worked fine and retrieved data.. I did not get any errors.
    WITH
    a_test as (
    select 'dummy' from dual
    select *
    from a_test
    This works as well.. retrieving the value of the parameter
    WITH
    a_test as (
    select :Test_ID from dual
    select *
    from a_test
    thanks,
    BIPuser

  • Using record with sql in clause

    hi friends
    i have a record and which have only some id's. and i have to use it with select in
    like
    Select * from aaaa where id in record
    how can we do it?

    JAVAMAN2 wrote:
    hi friends
    i have a record and which have only some id's. and i have to use it with select in
    like
    Select * from aaaa where id in record
    how can we do it?Well, a record is certainly better-er than an eight track, so you're on your way, soon you'll have a CD, then a DVD, unless you deviate and end up with a Laser Disc.
    Now, how about you post some technically relevant information describing in great detail 1) what you have and 2) what you want.
    For the former, you would want to tell us your oracle version
    select * from v$version;And all the pertinent information (technically speaking), as well as what you expect and why.
    If you can't take the time to post a thorough question, how can you expect anyone to provide a thorough (and correct) answer?

  • Access denied when using IdentityXML with WebGate

    Hello,
    Here is our setup:
    - COREid Identity 7.0.4,
    - COREid Access 7.0.4,
    - WebPass,
    - WebGate,
    - IIS 6 (hosting the identity application)
    We enabled the default policies to protect the /identity URL.
    We are using webservice calls (using C# with WSDL proxies) to query the identity server from other applications.
    Prior to enabling the Access policies this was working fine, now we get an Access denied error message.
    It looks like WebGate is blocking the IDXML calls.
    Does anyone knows what is causing this problem and how to solve it ?
    My first guess was to use the Access SDK to build an obSSOCookie and join it to the request, however the developper guide doesn't provide may examples on how to practically do this. Will it solve my problem ?
    Thank in advance,
    Franck

    Thanks for your answer.
    I eventually found a workaround for this problem.
    Actually you don't need to provide an SSO cookie the first time you connect to the webgate server, you just need to provide basic credentials and the webgate will provide you an SSO cookie that you can use for the next call.
    The problem is that this doesn't work out of the box with the .NET/WSDL framework for some reason (with Java + the HTTPClient library I had no problem).
    I had to had manually the following headers to the HTTP request to make it work:
    Authentication: Basic XXXXXXXX
    Cookie: OBBasicAuth=fromDialog
    Where XXXXXXXX is a base64 encoded string containing "login:password"
    Thanks,
    Franck

  • How can i use index in select query.. facing problem with the select query.

    Hi Friends,
    I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
    Here is the query:
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelat LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelatrprctr
        WHERE rldnr  = c_telstra_accounting
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          And rzzlstar in r_lstar                            
          AND rpmax  = c_max_period.
    There are 5 indices present for Table ZTFTELAT.
    Indices of ZTFTELAT:
      Name   Description                                               
      0        Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)                                          
      005    Profit (RCLNT,RPRCTR)
      1        Ledger, company code, account (RLDNR,RBUKRS, RACCT)                                
      2        Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)                           
      3        Account, cost center (RACCT,RCNTR)                                        
      4        RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR                        
      Z01    Activity Type, Account (RZZLSTAR,RACCT)                                        
      Z02    RYEAR-RBUKRS- RZZZBER-RLDNR       
    Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
    Thanks in advance.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • Problem with 0FIGL_VC1 when use constant selection in the query

    Please kindly help me. I have this problem for 2 weeks already.
    When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly. 
    My report layout
    Columns :  key figures  (including 0FIGL_VC1_CK001)
    Rows:  0GLACCEXT  (financial statement item) << as hierarchy
    Initially, the query is processed correctly.
    However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)  
    Please help!

    If I dont use constant selection in the query, data are display correctly.
    But If I use constant selection in the query, some financial statement item dont display any value
    Example :
       Financial statement item(Display in hier)     Period1   Total Period1(Constant selection)
                 A                                                       10            60
                 B                                                       20            60
                 C                                                       30            60
                 D                                                       0              60
    - Financial statement item "D"  has some value.
    - Financial statement item "D"  is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
    Please help!!

  • How to use Keyfigures in the Bex variable selection screen.

    Hi,
    I have a scenario, where the user whats to see the keyfigures like volume, amount in the variable selection screen, so that he can dynamically, set the condition according to his requirement.
    For example , he wants to see all the PO's for a particular calmonth which have volume >  1 Million or on someother day, he may input the value as volume > 2Million or Volume < 0 , so it depends. Similarly he wants to dynamically select the Amount values.
    I have tried using condition with "greater than"and value as a formula variable and it works for one condition, but if I add another condition i.e, "less than"and value as a formula variable then it conflicts and the query is throughing below error.
    "ERROR BRAIN (418): Variable ZCS_VAR_CH_KG_LT (DC015DZ850NUYVFDMPJHRGHXW) does not exist or is incorrectly used 4 Volume"."".
    Do we have a option to use customer exit in such a scenario ??, any suggestions please.

    Hi,
    Please check out the below link.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60b33a28-dca2-2d10-f3b2-d2096b460b1e&overridelayout=true
    Hope it suffice your requirement.
    Regards,
    AL

Maybe you are looking for