-ve values to 0 for query

Hi,
We have a formula calculated field in the query. it is resulting -ve values in some cases. we want to set,
If value of the formula is less than 0 then set to 0 else the value of the field.
Is there a way to set in the query itself. I tried using greater than 0. But results to 1 or 0. not 0 or value.
Any Ideas ? how do this in the query itself.
Thanks in advance,
GSM.

Hi,
may be this helps!!
create a formula which will check the values in the key figure, you can mention a condition if they are less than 0 then it will assign a value 0 else the same value it holds.
if,then and else keywords are replaced by + , * , / symbols. might be a bit confusing.But i will try to find a thread.
Try out n let me know if it works!
MM

Similar Messages

  • Use value of table for query

    if I am querying a jsp, and display the results in html, is it possible to get ticketid?
    remember, there are more than1 rows, so it cannot be
    <import java.sql.* >
    String ticketid = rs.getInt(<%...%>;
    basically, ge thte value displayed when generated in html...
    if i can do that, I can prob, do something similar to the message boards
    MUCH HELP!
    thanks!

    See bottom of:
    http://forum.java.sun.com/thread.jspa?messageID=3812266
    Sorry about not going into much detail. :D
    BTW: Is it possible to set an attribute of an INT?
    Much help!
    I'm a newbie and just want to say thank you for anyone who helps!

  • How can I reduce the selection for the characteristics value in a BW query

    Good morning,
    I need to find out how I can reduce the selection for the characteristics values in a BW query.
    In a BW query I have a characteristic "Due month".
    The characteristic values shown in the query are from 01.2001->03.2007. I would like to reduce it to the last 2 years,in the query view,  without deleting the data for the other years in the cube.
    Do you know how this can be done?
    Thank you in advance for your feedback.
    Kind regards,
    Linda Verding
    Staff Consultant - CSC

    hi,
    First thing you have to do is check the report how the data is being restricted only to those months.
    1) one it can be variable in which the code is written for that to populate for last few years.
    or else it must have been hardcoded for these months.
    Go into your report and underneath the characteristicsCALMONTH there must be an variable or hardcoding.
    You need to change this here in the report.
    You dont have to delete anything there.
    Regards, Siva

  • A filter value for Query is set with some value automatically

    Hello SAP sourcing Guru!
    I created a query which has several filters.
    Some of Filter's type is VLV.
    When I preview the query somehow the filter values are already set with some value even though I did not set the default value.
    For example, filter name is Region and there are four regions: Asia, NA, Europe, and SA.
    I want to select one of them from drop-down menu. But Asia was already selected when I clicked the preview button for the query. I want to see "Please Select" instead of Asia from drop-down menu. I did not select "Prefill value from cache" for the filter. I made the filter Optional only. I did not set Default Value either for the filter.
    Any clues?
    Thank you for your response in advance.

    Hi,
    In the Default value field of the filter prompts, you need to mention the Class Reference ID of the corresponding field. E.g., if you have Contract document phase as a filter, then in that if you want to display a blank or none value, then you should use null:2016.
    Similarly for vlv type, the system has a value 616. Hence if you want to display a None value insteead of Asia, use the following in the Default value field:
    0:616:null.
    The way to find the class reference ID is to goto the RG > Class Reference > Look for the field that you are attempting to default on.
    Hope this helps,
    Vikram

  • Need help with LikeFilter for querying the keyset instead of value

    Hi,
    I'm looking for help with the LikeFilter.
    I need to query the cache to get all entries with key starting with a particular string.
    I could see samples using LikeFilter for querying the values in the cache but not the keyset.
    Can someone help?
    E.g:
    Cache Entries:
    abc123 - value1
    abc234 - value2
    bcd123 - value3
    I want to get all entries with key starting with 'abc'.
    thanks,
    rama.

    NJ, thanks for the quick reply.
    I tried something similar (as below) but this code gives me 'java.lang.NoClassDefFoundError: com/tangosol/util/ValueExtractor'.
    KeyExtractor extractor = new KeyExtractor("getKey");
    Filter filter = new LikeFilter(extractor, id+":%",'-',false);
    -rama.
    Edited by: 911950 on Feb 2, 2012 1:18 PM

  • Variable entry screen for query doesnt show selection values.

    Hi,
    I've created a query with date varibale Quarter From-To. When i execute this query, the variable entry screen pops up but when i try to select values just shows ??? and not the text.
    if i run the same query in RSRT the variable entry screen pops up but here the selection values are present for me to choose from.
    can anyone tell why the values arent showing when the query is executed.
    Thanks

    yes, it seems to be a problem with NetWeaver BI BEx Java Web runtime as it works in RSRT and web analyzer. Found a note on marketplace note 125357 - No values displayed for attributes in input help but this did not resolve issue.
    A call has been raised now as it seems to be a product fault

  • Input Value long enough for date format ,Error in executing parallel query

    Hi,
    My Table: ANML( ID, STATUS,B_DATE,B_MONTH,B_YEAR, DEATH_DATE)
    status 1 for alive and 2 for dead.
    i wrote a view to get age.
    as
    create or relace view view1 as
    select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
    CASE
    WHEN anml_age < 1
    THEN 'D'
    ELSE 'M'
    END age_unit,
    CASE
    WHEN anml_age < 1
    THEN TO_CHAR (daysdiff || ' Day(s)')
    WHEN anml_age < 12
    THEN TO_CHAR (anml_age || ' Month(s)')
    WHEN MOD (anml_age, 12) = 0
    THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
    ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
    || ' Year(s) '
    || MOD (anml_age, 12)
    || ' Month(s)'
    END age_string
    from
    (SELECT a.*,
    CASE WHEN status IN ( 1)
    THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
    END anml_age,
    CASE WHEN status IN (1)
    THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
    END daysdiff
    from (
    SELECTanml.id, status,
    TO_DATE ( DECODE (b_date,
    NULL, 1,
    b_date
    || '-'
    || DECODE (b_month,
    NULL, 1,
    b_month
    || '-'
    || b_year,
    'dd-mm-yyyy'
    ) DOB,
    death_date
    FROM anml
    WHERE b_year IS NOT NULL
    ) a) top
    when i tried to fetch all values from view its working fine.
    But when i tried to fetch values based on condition like as follows,
    select * from view1 where anml_age > 20 and anml_age<30
    I am getting error like:
    Input Value long enough for date format and Error in executing parallel query
    Please tell me wht is wrong.

    Here is your formatted code
    create or relace view view1 as
    select top."ID",top."STATUS",top."DOB",top."DEATH_DATE",top."ANML_AGE",top."DAYSDIFF",
    CASE
    WHEN anml_age < 1
    THEN 'D'
    ELSE 'M'
    END age_unit,
    CASE
    WHEN anml_age < 1
    THEN TO_CHAR (daysdiff || ' Day(s)')
    WHEN anml_age < 12
    THEN TO_CHAR (anml_age || ' Month(s)')
    WHEN MOD (anml_age, 12) = 0
    THEN TO_CHAR (ROUND (anml_age / 12, 0) || ' Year(s) '
    ELSE TO_CHAR ( ROUND (anml_age / 12, 0)
    || ' Year(s) '
    || MOD (anml_age, 12)
    || ' Month(s)'
    END age_string
    from
    (SELECT a.*,
    CASE WHEN status IN ( 1)
    THEN FLOOR(MONTHS_BETWEEN(TRUNC(SYSDATE),dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(MONTHS_BETWEEN(death_date,dob))
    END anml_age,
    CASE WHEN status IN (1)
    THEN FLOOR(TRUNC(SYSDATE)-TRUNC(dob))
    WHEN death_date IS NOT NULL AND status IN (2)
    THEN FLOOR(TRUNC(death_date) - TRUNC(dob))
    END daysdiff
    from (
    SELECTanml.id, status,
    TO_DATE ( DECODE (b_date,
    NULL, 1,
    b_date
    || '-'
    || DECODE (b_month,
    NULL, 1,
    b_month
    || '-'
    || b_year,
    'dd-mm-yyyy'
    ) DOB,
    death_date
    FROM anml
    WHERE b_year IS NOT NULL
    ) a) top

  • Selection of Filter Values for Query Execution -Only Values in InfoProvider

    I created a query based on an ODS. For the query charateristic 0NFCAT_CODE a variable was created by me. To the time of query execution F4 shows all values available in the charateristic, but only values available in the ODS are expected.
    The characteristic 0NFCAT_CODE is a reference characteristic to 0CAT_CODE. 0NFCAT_CODE is compounded with 0NFCAT_TYPE (reference to 0CAT_TYPE) and 0NFCAT_GRP (reference to 0CAT_GRP). All characteristics 0CAT_CODE, 0CAT_TYPE and 0CAT_GRP are set to “Query Def. Filter Value Selection” =  “Only Values in InfoProv” and “Query Execution Filter Val. Selectn” =  “Only Values in InfoProvider”.
    Could anybody give me a help? Thanks in advance.

    Hi,
    that is master data of 0NFCAT_CODE.
    Regards,
    San!

  • LRM-00112: multiple values not allowed for parameter 'query'

    Hello,
    I am getting below error while trying to execute below query...please help:
    exp username/password file=query.dmp log=query.log tables=schema_name.tablename query=\"where PRODUCT_KEY IN\'4541450,4541455,4541475,4541504,
    4541505,4674142,4674201,4674202,4673982,4674000,4674114,4674118,4654432,4715806,4715807,4716122,4716133,4870247,5321008'/"
    LRM-00112: multiple values not allowed for parameter 'query'
    EXP-00019: failed to process parameters, type 'EXP HELP=Y' for help
    EXP-00000: Export terminated unsuccessfully

    yeah i have tried using paranthesis as well...it has given below error then:
    exp schema/password file=query.dmp log=query.log tables=schema_name.table_name query="where PRODUCT_KEY IN (4541450,4541455,4541475,4541504,4
    541505,4674142,4674201,4674202,4673982,4674000,4674114,4674118,4654432,4715806,4715807,4716122,4716133,4870247,5321008)"
    ./export.ksh: syntax error at line 1 : `(' unexpected

  • Get the Values with null for all dates

    hi,
     i have a scanrio to get the sales trend. The data look like below
    CREATE TABLE #T1
    ( Item varchar(50),
    SalesDate Date,
    Quantity int
    INSERT INTO #T1 VALUES ('Item1', '2013/02/01', 3)
    INSERT INTO #T1 VALUES ('Item2', '2013/02/01', 5)
    INSERT INTO #T1 VALUES ('Item1', '2013/02/02', 2)
    INSERT INTO #T1 VALUES ('Item1', '2013/02/03', 6)
    INSERT INTO #T1 VALUES ('Item2', '2013/02/03', 4)
    SELECT * FROM #T1
    Here i have 2 items sales details for 3 days. So user can get the sales trend by passing StartDate and EndDate as 2 parameters.  But it will return the existing date values only. In this example Item2 not have sales record in the table for '2013/02/02'
    But needs to give null values in the select Query
    My Existing Output
    Item SalesDate Quantity
    Item1 2013-02-01 3
    Item2 2013-02-01 5
    Item1 2013-02-02 2
    Item1 2013-02-03 6
    Item2 2013-02-03 4
    My expected output is
    Item SalesDate Quantity
    Item1 2013-02-01 3
    Item2 2013-02-01 5
    Item1 2013-02-02 2
    Item2 2013-02-02 null
    Item1 2013-02-03 6
    Item2 2013-02-03 4
    Can you help to write the query. I wrote using CTE but if the ITem is single value its ok. But for multiple items how can i get the empty dates

    akhil,
    Check if this helps you:
    --CREATE TABLE #T1
    --( Item varchar(50),
    -- SalesDate Datetime,
    -- Quantity int
    --INSERT INTO #T1 VALUES ('Item1', '2013/02/01', 3)
    --INSERT INTO #T1 VALUES ('Item2', '2013/02/01', 5)
    --INSERT INTO #T1 VALUES ('Item1', '2013/02/02', 2)
    --INSERT INTO #T1 VALUES ('Item1', '2013/02/03', 6)
    --INSERT INTO #T1 VALUES ('Item2', '2013/02/03', 4)
    SELECT * FROM #T1
    declare @tab TABLE(date_col datetime)
    insert @tab select '2013/02/01'
    insert @tab select '2013/02/02'
    insert @tab select '2013/02/03'
    ;with cte
    as
    select * from
    (select distinct Item from #t1) a
    cross join
    (select date_col from @tab) b
    select c.item,c.date_col,t.Quantity from cte c
    left join #T1 t on c.Item=t.item and c.date_col=t.SalesDate
    You have the following options for the population of @tab (that decodes the dates for which values are to be obtained):
    either explicitly as i have done
    using a select statement on #T1 like, insert @tab select distinct SalesDate from #T1
    or for past three days means, something like - getdate(),getdate()-1 and getdate()-2
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to create the layout for query in Bex 3.5

    Hi All,
    i have one requirement to do layout for query. Report like after passing the variable values and then they will select the required layout. It has to get output according layout selection fields.
    i have no idea about how to create layout.
            thanks in advance...
    Thanks & Regards,
    Mallikarjuna.k

    Hi Gregor,
    In the note 1149346 that you have mentioned, it says -
    You must start the input-ready query in change mode.
    BEx Analyzer: In the properties of the analysis grid, the switch
    "Suppress new rows" must not be set.  Furthermore,
    the switch "Allow entry of plant values"
    must be set in the local query properties.
    I have not seen this setting Allow entry of plant values in a query - can you tell what is refers to?

  • Can't select any value in radio to query report.

    Dear Support,
    About BI-BASE-B version is 1000.7.40.2.20.20130621014800 in portal,when we select value in radio to query report which lend to white screen,so i think that may be issue.But if i set manual value to query report,it is fine.So Connection is  available for system NBPCLNT800  in portal.
    error msg:
    #2.#2014 03 30 20:16:38:377#+0800#Error#/Applications/BI#
    #BW-BEX-ET-WJR#sap.com/com.sap.ip.bi.base#C000C0A8183501B60000000300007621#118639550000000004#sap.com/com.sap.ip.bi.web.portal.integration#com.sap.ip.bi.base.portal.connection.Localization#SYSADM#26##100FCD4DB80411E39272000007124BBE#113b773bb80511e3c097000007124bbe#113b773bb80511e3c097000007124bbe#0#Thread[HTTP Worker [@847096065],5,Dedicated_Application_Thread]#Plain##
    BI exception with class "ConnectionException" and message "Connection is not available for system NBPCLNT800". See default trace for log ID "null".#
    Thanks

    Hello Tom,
    could you please close this thread properly, so that others can find the solution, too? Please have a look at the blog How to close a discussion and why if you're unsure on how to do that. Thank you!
    Regards,
    Steffi.

  • Oracle Inventory: Inventory Value as on date Query

    Hi guys,
    We need to write a query to get inventory value based on a particular date, say '31-dec-2011' for certain auditing purposes. We can use historical transaction summary report for this purpose, however this report produces more than 800 pages for a single requirement.
    We were able to retrive the current inventory value using the following query
    SELECT SUM(moq.transaction_quantity*moq.item_cost) inv_cost
    FROM mtl_onhand_qty_cost_v moq
    WHERE organization_id = :p_org_id;
    Unfortunately none of our exercises from last couple of days fetch values anywhere near to the historical transaction summary report as on date inventory value for the above said cut off date.
    We tried the following query against mtl_material_transactions table
    Select sum(transaction_quanity*new_cost) inv_cost from mtl_material_transactions
    where organization_id = :p_org_id and
    trunc(transaction_date) > to_date(:p_date)+1 -- transaction value after '31-dec-2010' for example
    and then deducting value from second query from first query value...
    Please help
    Regards,
    raj

    Hi Sandeep
    I was able to run the API mentioned with before report trigger successfully, however cannot retrive any lines from cst_inv_qty_temp, cst_inv_cost_temp tables. I had gone through the API body and "assumes" this particular API repopulates the data each time when the report is submitted, identified by the unique session id.
    Would you comment?
    SET SERVEROUTPUT ON;
    Declare
    L_FCN_CURRENCY VARCHAR2(15);
    L_REPORT_NAME VARCHAR2(80);
    sql_stmt_num varchar2(5);
    l_exp_sub NUMBER;
    l_msg_count NUMBER;
    l_msg_data VARCHAR2(8000);
    l_return_status VARCHAR2(1);
    l_as_of_date VARCHAR2(30);
    l_cost number;
    wms_org_count NUMBER;
    pjm_org_count NUMBER;
    l_calculate_intransit NUMBER;
    l_cst_inv_val EXCEPTION;
    Begin
    BEGIN
    MO_GLOBAL.SET_POLICY_CONTEXT ('S', 111);
    END;
    CST_Inventory_PUB.Calculate_InventoryValue(
    p_api_version => 1.0,
    p_init_msg_list => CST_Utility_PUB.get_true,
    p_organization_id => 111,---:P_ORG_ID,
    p_onhand_value => 1,
    p_intransit_value => 1,
    p_receiving_value => 0,
    p_valuation_date =>to_date('2011/01/01 00:00:00','YYYY/MM/DD HH24:MI:SS'), -- to_date(:P_AS_OF_DATE,'YYYY/MM/DD HH24:MI:SS'),
    p_cost_type_id => NULL, --2, --:P_COST_TYPE_ID,
    p_item_from => NULL, --:P_ITEM_FROM,
    p_item_to => NULL, --:P_ITEM_TO,
    p_category_set_id => NULL, --:P_CATEGORY_SET,
    p_category_from => NULL, --:P_CAT_FROM,
    p_category_to => NULL, --:P_CAT_TO,
    p_cost_group_from => NULL,
    p_cost_group_to => NULL,
    p_subinventory_from => 'BBM-01', --:P_SUBINV_FROM,
    p_subinventory_to => 'BBM-01', NULL, :P_SUBINV_TO,
    p_qty_by_revision => 2, 'no'--:P_ITEM_REVISION,
    p_zero_cost_only => 2, 'no'--:P_ZERO_COST,
    p_zero_qty => 2, 'no' --:P_ZERO_QTY,
    p_expense_item => 2, 'no' -- :P_EXP_ITEM,
    p_expense_sub => 2, --'No', -- l_exp_sub,
    p_unvalued_txns => 2, --:P_UNCOSTED_TXN,
    p_receipt => 1,
    p_shipment => 1,
    x_return_status => l_return_status,
    x_msg_count => l_msg_count,
    x_msg_data => l_msg_data
    IF l_return_status <> CST_Utility_PUB.get_ret_sts_success
    THEN
    RAISE l_cst_inv_val;
    END IF;
    FND_MSG_PUB.count_and_get(
    p_encoded => CST_Utility_PUB.get_false,
    p_count => l_msg_count,
    p_data => l_msg_data
    IF(l_msg_count > 0)
    THEN
    FOR i in 1 ..l_msg_count
    LOOP
    l_msg_data := FND_MSG_PUB.get(i, CST_Utility_PUB.get_false);
    DBMS_OUTPUT.PUT_LINE(i ||'-'||l_msg_data);
    END LOOP;
    END IF;
    End;

  • Passing multiple values to a BI query

    Hi experts,
    This question has probably been asked a few times, but I have an issue with passing multiple values to a BI query.  Here's the scenario....
    1)  I have created a BI query.  When I test the query in VC I can enter values 1000:1100 in the Infoobject Business Area and I see that the values are passed through OK
    2)  Then I created a form where Business Area is an Input Field
    3)  I linked the form to the BI query and assigned value @Business_area
    3)  A table is linked to the BI query to view my result ( I have set a distinct before my table to view the data by fiscal year period)
    4) When running the VC model, the table show values for 1000 and 1100, but when I enter 1000:1100 and Submit it does not show both the business areas
    There must be something I am missing and I thought it was that in my submit string (between the input form and the BI query) that I should fill in some values (instad of @Business_area). I tried to fill in 1000:1100, but then I get an error saying Invalid time 1000:1100.
    I would really appreciate any help on this issue :-).
    Regards,
    Thomas

    Hi Thomas,
    I wish to enter default values for dates onto the VC form. Ie I have a VC report to display a customer's shipped data. Ship date is a selection field/ input field on the form for the report/ output table.
    At present if a user clicks submit they get all their shipped records from the beginning of time till today. How can I restrict the dates at VC level to past  3months? So if the users don't specify a ship date, they get the past 3 months data, and afterwards they can change it an retrieve all the data or past 2 years as they wish.
    Thanks,
    Jasmine

  • How to Change Value set Dynamically for a Parameter in Apps?

    Hi All,
    I have a requirement where i need to change the value set dynamically for a given Parameter. This goes as, I have a Concurrent Program with 4 parameters. First Parameter is mandatory Business group.Second Parameter is Warehouse. Based up on the First parameter the second parameters LoV's are displayed, the third and fourth parameters value sets are dependent up on the Second parameter value. Parameter 2,3,4 Value sets are Table type. So i Used .$FLEX$.Value_setname to retrive the LOV's
    The Requirment now is that if the User doesn't enter the Parameter 2 than the Third Parameter field must be Open and he must be able to enter the Free text. In my case it is an Order Number. If the User enters the paramter 2 value than LOV's for ORder number pertaining to that Warehouse must get displayed. I've figured that this can be possible only if i change the Valuesets Dyanamically. I'm not sure if that is possible or not.
    I have tried :
    Using a Dummy Parameter with a new valueset(Transactable Independent) and giving Y and N based up on Warehouse parameter input.
    SELECT (DECODE ( :$FLEX$.WAREHOUSE_NAMES,NULL,'Y','N')) from dual;
    The default type was SQL.
    Then in the 3rd Parameter i have used Case function to differentiate Y or N. The third parameter being ORder number, is a table type and derived from Oe_order_headers_all.
    In the Query section i tried using dummy parameter value set to retreive the values. I was terribly Unsuccessful in doing so.
    Does the above Case exists or is Doable? Please, Help me out if somone had worked on Similar thing or have any idea of standard report/program using it in Oracle.
    Thanks alot for the Help!

    You will probably have better luck on the eBusinesSuite forum. This is more of a setup issue when defining your LOV and program parameters than it is a SQL or PL/SQL issue.
    http://forums.oracle.com/forums/category.jspa?categoryID=3
    Good luck - this is an aggravating issue to work with and I wish I did have the answer for you!

Maybe you are looking for