Formula If/Then/Else question

Hello all,
  I am using the following formula to read one value (valuation price), and if it = 0, then display the value of another field (moving price), if <> 0, then display that field (valuation price). 
( 'Valuation Price' == 0 ) * 'Moving Price' + ( 'Valuation Price' <> 0 ) * 'Valuation Price'
However, only the first part of the evaluation returns a value, ie only the rows that have a valuation price =0.  If I reverse the order, it does the same thing, almost like it won't evaluate the "else" part of the evaluation.
If anyone see's something obvious I would appreciate your input.  I have read the help file and done some searching but have found nothing relevant.  
Thanks for any help
Bill Coombs

Bill, change your formula to
( NODIM('Valuation Price')== 0 ) * NODIM('Moving Price') + ( NODIM('Valuation Price') <> 0 ) * NODIM('Valuation Price')
Hope this works.
-KRREDDY

Similar Messages

  • Formula if/then/else

    Hello,
    I am a basic Crystal Report designer and need help with a formula.  I need to check 5 different fields and return a specific test if the field data does not equal zero. So here it goes below. I used "totext" because the value in the fields are a number either 0 or some other number so it does not matter what the # is as long as it does not = 0 I  need the following values.  I will then need to insert a single column in the report.
    When I try what I have below, all that's being returned is "Services" so I'm assuming it's not checking the other fields.  Assistance is appreciated.
    if totext ({BP_Daily_Item_Report.OBJ_B_SRV_THIS_REQ}) <> "0" then "Services" else
    if totext ({BP_Daily_Item_Report.OBJ_B_COM_THIS_REQ}) <> "0" then "Commercial"  else
    if totext ({BP_Daily_Item_Report.OBJ_B_CDC_THIS_REQ}) <> "0" then "CDC" else
    if totext ({BP_Daily_Item_Report.OBJ_C_SYS_THIS_REQ}) <> "0" then "Systems"
    Thanks.

    Thank you both.  Using that formula, I did get an error "the keyword then is missing"
    ({BP_Daily_Item_Report.OBJ_B_SRV_THIS_REQ},"#") "0" then "Services"
    So I modified my original forumla by removing totext and the "0" then is said "must be a number. I then removed the " " from around the 0 to what is below and that worked
    if ({BP_Approved_Requests.OBJ_B_SRV_THIS_REQ}) <> 0 then "Services" else
    if ({BP_Approved_Requests.OBJ_B_COM_THIS_REQ}) <> 0 then "Commercial" else
    Thanks.

  • IF Then Else question in PL/SQL script

    Hi guys, this will be an easy one for most of you. I'm just looking for advice on the most efficient way of doing this. I have 15 fields where I need to check that the value doesn't equal a group of values. For example, NG,NA, NOT KNOWN etc. If the fields are equal to any of these values I want the variable set to null so a blank space is printed out.
    I've started of doing it like:
    IF v_service_request_id IN ('Not Given', 'NG') THEN
    v_service_add_last_name := NULL;
    END IF;
    but I'm just wondering if this is the best way to do it? At this rate, I'm going to have this piece of code in 15 times, once for each variable. Would I be more efficient using case statements or some other function?
    Also, where it says IN ('Not Given', 'NG') this is just an example of the values I'm checking for. In reality there's around 30. Is there any way I could put these values into some sort of stored list and then just say:
    IF v_service_request_id IN (some_stored_list) THEN
    v_service_add_last_name := NULL;
    END IF;
    Thanks everyone, I'd appreciate any help.
    Ian

    Assuming the list of 30 values id the same for all fields, then another alternative would be to create a function in the same package to do the test. Something like:
    CREATE PACKAGE p AS
       PROCEDURE my_main_proc (p_pam1 IN NUMBER, p_pam2 IN VARCHAR2);
    END;
    CREATE PACKAGE BODY p AS
       FUNCTION test_values (p_val IN VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
       IF p_val IN ('Not Given', 'NG', 'NA', 'Unknown') THEN
          RETURN NULL;
       ELSE
          RETURN p_val;
       END IF;
    END;
    PROCEDURE my_main_proc (p_pam1 IN NUMBER, p_pam2 IN VARCHAR2) IS
    << Declare local variables >>
    BEGIN
       << get records >>
       v_service_add_last_name := test_values(v_service_request_id);
       v_other_field := test_values(v_other_id);
    END;
    END;You still need to maintain the list in the function, but only in one place.
    HTH
    John

  • Problem in If-Then-Else formula in report

    Hello guys!
    I use an If-Then-Else statement in a Calculated Key Figure (Cf. <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm">Conditional Calculations</a> ) and it works great with basic calculations.
    I have a query (done in BI 7.0) where I display, for each calendar months (via 0CALMONTH), the usage (stored in a normal key figure in hours) of several products.
    I need to take into account only the products that have been used for at least 60% of the time of the highest product for each month. I a single product, for a month, has been used less than 60% of the highest one, it should be considered as not being used at all (so the calculated usage would be = 0), otherwise, its usage is counted as normal.
    In order to achieve this, I thought I would display the normal usage (the regular key figure) in column A, a calculated key figure that determines the MAXimum usage for each month in column B (which should be the same for all products) and another calculated key figure that displays the result of the If-Then-Else statement in column C.
    In rows, I have 0CALMONTH and the products.
    HOWEVER, when I do this, the result is incorrect. This is probably because to determine the MAX usage, I use a local calculation option, which displays the correct maximum usage on each row but it's not correct when used somewhere else.
    <b>MY QUESTION IS: HOW can I display the maximum usage for a month on all rows without using the calculation option (and therefore would be correctly used by the If-Then-Else statement. I tried an aggregation exception but it doesn't really work (it works only on the total, but I need to do the calculation on each individual row).</b>
    <u><b>Any useful comment will be greatly appreciated </b></u>
    Thanks in advance!

    Hi Francal ,
    Have you tried it . The constant selection will work if you have defined the calculated key figure correctly i.e. Aggreagtiomn "Max" with "product" as ref characteristic. Then you have to use this calculated key figure in your query , restrict it by "product" and make it a constant selection.
    The calculated key figure it self  will bring the highest usage for Month + product + ( any other characteristic you have in query ) but this will only apply to result . If you use constant seelction on top of it it will make sure that you see same value for all product for a particular month( and other characteristic combinations if you have ).
    I have built similar queries and it works . By the way which versions of backend and frontend you have ??
    Regards
    Sanjay

  • Question regarding the If-then-else function

    Hi folks ,
    I have been constantly putting threads on this subject for the past day,  hope it doesn't annoy any one here.
    My scenario is really simple, and i am  almost close to the solution, but there is just 1 thing missing and i know that is a very small thing, could be the context too. Hope some one can help by pointing it out>
    Mapping:
    In my source i have a header(0-unbounded) & detail(0-unbounded). At a given instant either header / detail will occur in source, depending on that the target node "response" will occur(0-n times)
    i have achieved this in the mapping.
    the problem is this:
    Both the Header/Detail have a field in it called Sequence# which is mandatory and can occur only once in the Header/Detail node.
    Now depending on what occurs: ie Header/Detail i need to map that particular seq# into my Target Respone's SEQ_#.
    I have done the mapping for this and have done a standalone testing.
    Mapping: Check if HEADER EXISTS, if yes? then map the HEADER.Seq# to TARGET.Seq#
    Here are my findings:
    Scenario1: 3 header nodes(No Detaili) each with a seq # in it. Out put 3 Target node each with 3 seq # in it.
    Scenario2: 2 Detail Nodes(No header) each with a seq # in it. Output fails to produce the 2nd Target Structure's Seq# and Fails
    When i look into the Display Queue in the mapping , i examine the iF-Then-Else function:
    Since HEADER doesn't exist i c 1 Suppress in my If-Condition hence the if condition becomes FALSE., now since its false its supposed to map the seq# from my detail. (This case i have 2 ).
    But in the output of the IF-Then Else, i get out only 1 seq # which is the 1st one,
    What i am thinking is that the exists condition is giving out only 1 FALSE instead of 2, If there were 2 false from the exists then i would have had both the seq # in my output,
    I hope my question is clear, Would appreciate anysort of help . And i apologize if I seem to be brigning up the same question over again experts.
    I don't wnt to create a UDF for this matter because i know there is something i am not doing right,
    Hank

    Sorry I could not give my udf in my last post.
    Udf1:
    Create a context udf and name it as RemoveSuppress. Take two input arguments a and b. Imports: java.*;
    Add this code:
       //write your code here
    boolean found = false;
    for (int i=0;i<a.length;i++) {
         if (a<i>.equals(b[0])) {
         found = true;
         break;
    if (found == true)
         result.addValue("true");
    else
         result.addValue("false");
    Then it should work.
    Regards,
    ---Satish

  • Sum function within if/then/else (xdofx:if)

    I'm attempting to display a total at a particular group within my report. This total is conditional and should choose to display a placeholder value or the sum of another placeholder value (in a child group).
    I have been able to vary my output based on the value I want to check: FIXED_QUOTE_FLAG - I have the if/then/else working in a simplified fashion
    I can display literals and some placeholders correctlly eg. print a literal value of 00110011 or the value of placeholder QUOTED_PRICE
    I can also display a calculated placeholder, using sum within the group I am concerned with: sum (current-group()/ACTIVITY_CHRG)
    But when I try to get everythign working together ...
    I cannot get the sum to work inside the if/then/else condition. The result is NULL (blank in HTML output).
    The following is the snippet which is not working correctly:
    <?xdofx:if FIXED_QUOTE_FLAG = 'Y' then QUOTED_PRICE else sum (current-group()/ACTIVITY_CHRG) end if?>
    Message was edited by:
    gareth_adamson

    To answer you first question, perhaps sum is not a supported function in the xdofx namespace. It's annoying when this problem comes up because xdofx namespace seems to be the only way to do if then else clauses. I'm not entirely certain on the above, but you could resort to using BI Publisher's built-in if statement.
    For your problem, something like this:
    <?if: FIXED_QUOTE_FLAG='Y'?>
    QUOTED_PRICE
    <?end if?>
    <?if: FIXED_QUOTE_FLAG!='Y'?>
    <?sum(current-group()/ACTIVITY_CHRG)?>
    <?end if?>
    EDIT:
    There is a way to do if else without xdofx namespace. It is done with <?choose:?> <?when:?> and <?otherwise:?> tags. Here is example syntax copied from Tim Dexter's blog:
    <?choose:?>
    <?when:count(TRX_NUMBER) > 0?>
    Invoice Table
    <?end when?>
    <?otherwise:?>
    No Data Found
    <?end otherwise?>
    <?end choose?>
    To answer the second question about a running total, you will need to use the <?xdoxslt:set_variable($_XDOCTX,'var_name',var_value)?> and the <?xdoxslt:get_variable($_XDOCTX,'var_name')?>. This method of working with variables is the only method that allows you to update a variable. This makes it good for running totals. Consult the official user guide under "Creating an RTF Template" the section about using variables and calculating running totals.
    So, in your problem, once you get the first part working, you will have to add that value to your running total. It will look something like this:
    <?xdoxslt:set_variable($_XDOCTX,'running_total',xdoxslt:get_variable($_XDOCTX,'running_total') + conditional_value)?>
    Remember to initialize the running total to zero! Hope this helps.
    Thanks,
    Matt Soukup
    Message was edited by:
    Matt Soukup

  • Select in CASE statement or in IF-THEN-ELSE

    I have been struggling for a week with a problem and still can't solve the way I want.
    Given four text fields in page : p1_name, p1_place_name, p1_place_number and p1_place_init_letter - where user types text and press 'Search' button to see the results.
    p1_name finds results in table EMPLOYEES
    p1_place_name, p1_place_number and p1_place_init_letter find results in table PLACES
    the two tables are linked by id_place field
    I would like reports to be shown depending on search results:
    - if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist AND EMPLOYEES.id_place = PLACES.id_place then a single report shows only employee row
    - if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist AND EMPLOYEES.id_place # PLACES.id_place then two reports showing 1) employees with name = :p1_name and 2) places with name, number and init_letter = :p1_.....
    - if p1_name not exists and (p1_place_name and p1_place_number and p1_place_init_letter) exist then a message with 'NO EMPLOYEE' and report shows only places where name, number and init_letter = :p1_.....
    - if p1_name exists and (p1_place_name and p1_place_number and p1_place_init_letter) not exist then report shows only employee row where name = :p1_name and message with 'NO PLACE'
    - if p1_name not exists and (p1_place_name and p1_place_number and p1_place_init_letter) not exist then messages 'NO EMPLOYEE' and 'NO PLACE'
    I do NOT know if it is possible, and if it is, then what do I have to use : IF - THEN - ELSE or CASE ?
    I tried to build HTML report region conditionally shown for each situation, but they do not work the way I want.
    Could you please help me ?
    Thank you in advance !

    Agree with Dan. Use a dedicated report region for a unique query. Use a rendering condition to determine if that reporting region must be rendered (i.e. whether or not that reporting query must be executed ).
    The alternative is creating a function that constructs the SQL query dynamically, based on the user supplied values for page items. Use the function as the source for the reporting region, instead of a SQL statement. (this is similar to creating a ref cursor for a client, minus the actual step to create the ref cursor - instead the source SQL for that ref cursor is returned).
    Also consider asking your Apex questions in the dedicated Apex forum on OTN.

  • Query if-then-else logic with calculation

    Hello,
    I want to calculate within a BEX-formula.
    I have two key-figures:
    - Quantity
    - Value
    The logic should be like this:
    IF Value > 0 THEN Value / Quantity ELSE 0
    ( / means: divided)
    How can I reach this?
    The URL
    http://help.sap.com/saphelp_nw70ehp1/helpdata/de/e3/e60138fede083de10000009b38f8cf/frameset.htm
    does not help me.
    Thanks for your help,
    Thomas

    That is the way to perform if then else...
    As long as boolean operations returns 0 or 1 you must play with that in order to get the desired result.
    In case you have DIV problems you can use this operator:
    NDIV0 (x): Is equal to 0 with division by 0, otherwise x.
       NDIV(<Expression>)
    Delivers 0 if the expression named in <Expression> gives a division by 0 in
    the calculation. Otherwise, the result is the value of the expression.
    Is used to
      - Avoid the output of an error message
      - Continue calculating with a defined result
    Please give an example if I am missing something.
    Regards,
    Sebastian,.

  • How to write Boolean function (If Then Else)?

    Hi all,
    I have a logic to write in the query. It is:
    If (A = 0 and B = 0)
    Then 0
    Else
            If (A = 0 and B > 0)
            Then 100
            Else
                   A/B  (we want to show %)
    How to use boolean function to write this Netted If Else statement? Thank you in advance!

    Hi
    If (A = 0 and B = 0)
    Then 0
    Else
    If (A = 0 and B > 0)
    Then 100
    Else
    A/B (we want to show %)
    1. create a formula in the query designer. and use this formula for if - else
    ( ( (A==0) AND (B==0) ) * 0) +  ( ( a==0 ) AND (B >0 ) * 100 + (A/B*100) )
    : denotes THEN
    + : denotes ELSE
    See if this works.
    Assign points if helpfull
    From
    ManesH

  • How to write Boolean function (If Then Else) For Date Caluclation.

    Dear All,
    I have a scenario where i need to calculate Position time hold by an employee in an organisation.
    I have 2 date Char ( DATE FROM & DATE TO), the problem is that is , If an employee is having
    2/3 position in an organisation its current position End Date is always 31.12.999 as its End date is
    not know. For previous position End Date is maintained.
    My requirement is to calculate Position hold time including Current position.
    Can it be done directly in formula variable with If Then Else condition.
    or i need to write user exit if its exit,
    please guide me for ABAP Code.
    Thanks V V much.
    Regards,

    Hi,
    Following options are available for you:
    1. Is the valid to, valid from dates available as a result of standard time dependency of navigational attributes? if yes , you can not use them in calculations, in such case you may have to write a full fledged routine at formula variable, using uxer exit.
    2. Another simple method, that i would suggest would be using temporal joins (infoSets), that precisely fits you case.
    Helpful links:
    About Infosets:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/ed/084e3ce0f9fe3fe10000000a114084/frameset.htm]
    About Temporal joins:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/11/723c3b35703079e10000000a114084/frameset.htm]
    Hope this helps.
    Cheers,
    Sumit

  • Inserting a 'null' value in an IF THEN ELSE statement

    Greetings,
    I'm using Business Object webi XiR3
    I'd like to return a 'null' value in certain cases for an IF THEN ELSE statement.  Depending on if I format the field as a text or a number, I can return blanks ("") and zeros (0).  However, what I really need to do is leave the field / column formatted as a number and return a 'null' value.  You can see the variable below ... this will return a blank but the column is text.
    Suggestions?
    thanks.
    variable:
    =If([Comp Rate Mid] = 0 And( ([Market Rate 50th].085) - [Annual Total Targeted Comp] >=0) ; ([Market Rate 50th]0.85) - [Annual Total Targeted Comp]; If([Comp Rate Mid] <> 0 And( ([Comp Rate Mid] 0.85) - [Annual Total Targeted Comp] >=0) ; ([Comp Rate Mid]0.85) - [Annual Total Targeted Comp];""))

    I don't think this is possible using a formula, as formulas deal with content, and images can be placed in cells only as 'image fill', which is Format, rather than Content.
    Might be possible using an AppleScript, but I'm not the person to advise you on that.
    Regards,
    Barry

  • Values are not populated properly - if then else conditon

    Hi,
    I 've a requirement like...
    If meinh = ZTU then lfimg/umrez else display the values of lfimg
    I 've used if then else condition afterthat i mapped to target field lfimg. But, when i check the queue the result displays correctly, but when i execute the mapping from Test tab it displays all the values for LFIMG
    My question here is ...Why the output is not display properly after i use if then else condition
    Help me how can i get proper values to display at target
    Kind regards,
    Y.Raj

    hi
    As my understanding you are giving both cases true and false the same input.
    If meinh = ZTU then lfimg/umrez else display the values of lfimg
    if meinh = ZTU
    then  umrez
    else  lfimg
    try this
    if still its not working write a simple UDF for the same.
    Regards
    Vijay

  • Doubt in IF--THEN--ELSE

    i have a doubt with the body of IF--THEN--ELSE construct.
    Normally, we have:-
    if (statement) then
    else
    end if;
    If i include another if--then--else construct in the else part, like :-
    if (statement) then
    else
    if (statement) then
    else
    end if;
    end if;
    would it produce unexpected results or would it be ok.
    I hope, my question is clear. Please help in solving the doubt as it is urgent.
    Regards.

    Unreadable, incomprehensible, unmaintainable, bug ridden code can be written using any construct known to programmers. This is particularly true when dealing with conditional logic. It is not the particular construct chosen, but the faulty reaoning and lack of proper testing that leads to bug ridden code.
    The following is a greatly simplified version of some code I came across recently. The comment is a direct quote.
    CREATE PROCEDURE test (p_num IN NUMBER) AS
    BEGIN
       CASE
          WHEN p_num > 5 THEN
             process_common_status();
          WHEN p_num = 4 THEN
             process_exception_status_four;
          WHEN p_num = 5 THEN
             process_exception_status_five;
          WHEN p_num = 6 THEN
             -- New status 6 must be handled with special care
             -- in the rare case it happens
             process_exception_status_six;
          ELSE
             process_other_exceptions;
       END CASE;
    END;Although I am not asking you to prove your assertion, I would be interested to see some of the documentation you refer to.
    John

  • Problem with IF THEN ELSE in RTF template

    HI ALL,
    I have two layouts in the RTF template. Based on the parameter value it has to show the value.
    For example if P_State='United States' then first layout should come. else second one should come.
    I tried to use the IF Then else logic through the form field but i am getting error.
    Please help on this to get it.
    Regards
    Boopathi

    You can do that.
    i guess, the syntax you are using is wrong.
    please refer documentation or this forum for choose:
    Use choose statement. it s better.
    Or send me the template to my id in my profile. or upload it here http://apps2fusion.com/forums/viewforum.php?f=60

  • If Then Else Statement in SAP R/3 BW

    Hi,
    Does anyone know how to create an If Then Else statement in BEX?
    Thanks,
    Mounika.

    Hi mounika,
    do this way
    If 'material number' > 0.
    rslt = 'enter into table'.
    else.
    rslt = 15.
    endif.
    A True condition always evaluates to 1, a False condition evaluates to 0.
    for more quieries in bw ..pls go through  the link
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw
    pls reward if helps,
    regards.

Maybe you are looking for

  • Permissions on Postx Jar for CRES

    Hi, When I try to read an incoming secure message (CRES Registered Envelope) using a browser, I get the following error regarding missing permissions on a Postx jar: If I continue to run, I get the following second message. I cannot decrypted the mes

  • Giving to @XmlJavaTypeAdapter a generic type value

    Hi all I have a critical problem with adapters used at jaxb unmarshall some of my fields have type enumeration. I decided that is best to use same adapter class for all enums so i created a generic enumeration adapter. I'm not sure if is 100% ok but

  • Converting from Single Byte to Multi Byte character set

    Hello, I'm trying to migrate one schema, including data, from a 10g (10.1.0.2.0) DB with IW8ISO8859P8 character set, to a 10g (10.2.0.1.0) DB with AL32UTF8 character set. The original tables are using VARCHAR2 columns, including some VARCHAR2(1) colu

  • Help opening a project I saved yesterday

    Hi there I'm running After Effects 5.5 on Win 7 64bit, and have not had reliability issues or similar (until now) - my last project (which lasted several weeks) went without issue in this latest version of After Effects, on this same system. Yesterda

  • Hyperion EPM configuration

    Hi, We are unable to register 'Shared Services' in Hyperion EPM configuration. It shows status as failed please help us to resolve. Reg, kannan