BAM If Then Else or Switch function

I have BAM data object called "Vehicle" which gets populated via messages coming in through from the enterprise message source. I have a requirement for a calculated field ArrivedStatusTime in the data object. In normal programming language I would just say where UnitStatus, StatusTime are other fields in the same data object.
If(UnitStatus =="AD"){
Then substitue value of field ArrivedStatusTime = StatusTime
The same in BAM is difficult as it enforces the usage of else for which I have no use. Also there are no working examples of BAM function syntax for comparision of Strings (say a data object field UnitStatus =="AD) on the internet. Also my requirement is have the ArrivedStatusTime field should not be overwritten by other messages coming in with UnitStatus other than "AD"
Please suggest, simple logic like this is hard to implement in BAM.
Thanks

Again, {} is only required when the field name has special characters in it. Otherwise, it can be used as it is.I adopted the use of braces {} as the best parctices and I highly recommend it.
"Column names containing any special characters, such as the operators listed in Table 31-1 double quotation marks, or spaces, must be surrounded with curly braces {}. If column names contain only numbers, letters and underscores and begin with a letter or underscore they do not need curly braces. For example, if the column name is Sales+Costs, the correct way to enter this in a calculation is {Sales+Costs}."I've had cases - can not remember where it was - that the non use of curly braces in field names without special characters shown error messages. So, this intermittent result reiterates my recommendation.
[]s
Luciano Gomes

Similar Messages

  • 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

  • Wierd Behaviour of IF then ELSE standard function

    Hi All,
    I am facing a very wierd behaviour of the IF then ELSE function in a mapping.
    Condition to be checked:   if GDS_id = 1, then (condition 1 -  RFC lookup ) ElSE (condition 2 - JDBC Lookup followed by an RFC  lookup).
    Issue:  The input payload is 0-unbounded with a possibility of a different GDS_id values.
    Case 1 :
    As shown below, in case the input payload has 3 repitions of the RECORD, with the Fit set having GDS_ID = 01, the mapping runs perfectly fine . All the If then Else branches are getting executed.
    Case 2:
    Where as iF the first GDS_ID != 01 (not 01) , thenthe target value is not getting populated properly .
    I have tried all the possibilities and combinations but i am unable to resolve this. Please help.
    Attached the screen shot of the message mapping, and sample test results of both the use cases.
    For instance, below is a sample payload:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:mt_EMERGO_common xmlns:ns0="http://sabreEMERGO_common.com">
    <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
          <gds_id>01</gds_id>
          <pos_code>RD3A</pos_code>
          <gds_code>01</gds_code>
          <net_booking>11</net_booking>
       </Record>
    <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
         <gds_id>02</gds_id>
          <pos_code>54S8 </pos_code>
          <gds_code>02</gds_code>
          <net_booking>11</net_booking>
    </Record>
      </ns0:mt_EMERGO_common>

    Hi All,
    I have changed the message mapping like below. Even though i am not getting my target filed as value. As per my requirement if GDS_ID=01  then perform the RFC lookup and pass the value to target fields KUNNR and else GDS_ID=02 then perform the JDBC LOOKUP and JDBC LOOKUP output to RFClookup .RFC LOOKUP output pass to my target field KUNNR.
    Result of my mapping is 1st record only populated KURNNR in Target side and 2nd record not showing as KUNNR filed in target side .But I have taken look on display queue in If then else out showing 2 values but it is not passing to target filed.
    Please provide any suggestion to resolve this issue.
    Please find the mapping logic:
    Please find the test screen:
    Please find the test Data:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:mt_EMERGO_common xmlns:ns0="http://sabreEMERGO_common.com">
       <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
         <gds_id>02</gds_id>
          <pos_code>54S8 </pos_code>
          <gds_code>AA</gds_code>
          <net_booking>11</net_booking>
       </Record>
       <Record>
          <booking_date>08012013</booking_date>
          <iata_code>2325540</iata_code>
          <gds_id>01</gds_id>
          <pos_code>RD3A</pos_code>
          <gds_code>AA</gds_code>
          <net_booking>11</net_booking>
       </Record>
    </ns0:mt_EMERGO_common>
    Regards,
    Ramesh

  • 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

  • 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

  • If then Else using DAX Calculation

    Hi all, new to DAX. I am trying to replicate a Oracle SQL column using DAX functions in SSAS Tabular.
    My Oracle column is defined like below:
    If STATE_CODE Not in('A','B','C','D') 
            And Not (substr(PK_ID,4,2) = 'XY' And DIV_CODE in('YU','SD')) Then
             CNT = 1;
          Else
             CNT = 0;
    Any ideas how to start? Should i use DAX Switch function ?
    Thanks,
    TAG

    We have IF and Switch Function Available in DAX .
    You can use any of one.
    IF(logical_test>,<value_if_true>, value_if_false)
    For Switch you can use below;
    SWITCH(TRUE(),
    booleanexpression1, result1,
    booleanexpression2, result2,
    else
    Just create calculated column in Cube and add this logical IF/Switch function there.
    Or If you want to calculate this at query level using DAX then you can follow below Query.
    Evaluate
    ADDCOLUMNS
    TableName,
    , "calculated column"
    ,IF( Logical,Truecondition,False Condition)
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com

  • Is there an example to use interface to replace if then else pattern in F#

    is there an example to use interface to replace if then else pattern in F#
    i want to make match pattern with only one rule to represent dynamic number of rules which is use 
    let rec fun1 m number fun2param =
        match m with
        | fun2param(a,b,number) -> ****rewrite terms ****
    let fun2param number =
        if number = 1 then
                 function.....
        elif number = 2 then
                function ....
    computing nightmare

    In general, you use a match
    let fun2param number =
    match number with
    | 1 -> function.....
    | 2 -> function ....
    in the same way as you would use a `switch` construct in 'C' in place of a repeated if/elif...elif/else
    Your request is somewhat vague, so I'm not sure whether you would benefit from wrapping that behind an active pattern.

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

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

  • Implementing if then else condition

    Hi! All
    It would be very helpful if i can get answer of how to implement the condition below, using the functions available in graphical mapping editor....
    I need to map 2 source fields to 1 Target field, based on the condition that field(source) is populated in the target field only if field 1 is null.
    Source----->Target
    part_id1----
    >part_num(if part_id1 is null,then part_id2)
    part_id2----
    >
    I tried using if then else function, it is working fine but errors out when part_id is null....need to make it work even when part_id1 or part_id2 is null.If both fields are null it should not populate anything.The boolean function is not accepting null inputs...
    Please, let me know if there is a better way to implement this logic...Thanks a lot!
    Regards,
    Patrick

    Jones,
    Have this logic in your mapping:
    part_id1>exists>and
    part_id1>equals(textfunction)>null(take constant and dont put any value in it)>equals(text funciton)>false
    Give the above two to if
    Then in the then part give part_id1 and in the else part give part_id2.
    So in the above if part_id1 exists and equals to null then part_id2 will be output and part_id1 exists and not equals to null then part_id1 will be the output and part_id1 doesnot exist then part_id2 will be the output.
    Regards,
    ---Satish

  • If then else emulation

    it is not very efficient, but nevertheless works.....
    since xmlp is very limiting on the size of a statement, you need to keep it simple.....
    Its better then using multiple if statements which is what we had to do in the past.
    5.6.3 is supposed to have a if-then-else statement so can't wait to get there.....
    here is the code....
    <?choose:?>
    <?when:sum(LINE_UNIT_SELLING_PRICE)<400?>LOW<?end when?>
    <?when:sum(LINE_UNIT_SELLING_PRICE)>399 and sum(LINE_UNIT_SELLING_PRICE)<4000?>MED<?end when?>
    <?otherwise:?>HIGH<?end otherwise?>
    <?end chose?>

    other helpful syntax
    <? format-date: @orderdate; 'DD-MMM-YYYY' ?>
    <? format-number: ./price; 'L999G999D99' ?>
    TOTAL ITEMS: <? count(items/item) ?> works like sql count
    <? for-each:items/item ?> Item <?position() ?> <? end for-each?> works like sql rownum function
    to set and get variables
    Hope someone finds these useful....

  • Usage of exists in if-then-else statements

    please correct the mistakes in this procedure regarding exists in the use of if then else statement .as i am new to oracle i am unable to do it.
    errors are statement ignored
    exists should be inside the statement;
    CREATE or replace FUNCTION CHECK_FG_Id
    p_LegacyDocumentId VARCHAR2,
    p_LegacyFGroupId VARCHAR2,
    p_TransmissionId INTEGER
    RETURN INTEGER as
    BEGIN
    IF EXISTS
    (Select FG.ControlNo from functionalgroup FG,document D
    WHERE FG.DocumentId=D.Id AND D.TransmissionId=p_TransmissionId
    AND FG.ControlNo=p_LegacyFGroupId AND D.ControlNo=p_LegacyDocumentId ) THEN
    Return 1;
    ELSE
    Return 0;
    END IF;
    end;

    Lots of different ways...One way is as follows:
    CREATE OR REPLACE FUNCTION check_fg_id (
    p_legacydocumentid VARCHAR2,
    p_legacyfgroupid VARCHAR2,
    p_transmissionid INTEGER) RETURN INTEGER AS
    vDoesItExist NUMBER;
    BEGIN
    SELECT COUNT (1)
    INTO vdoesitexist
    FROM functionalgroup fg,
    document d
    WHERE fg.documentid = d.ID
    AND d.transmissionid = p_transmissionid
    AND fg.controlno = p_legacyfgroupid
    AND d.controlno = p_legacydocumentid;
    IF vDoesItExist > 0 THEN
    RETURN 1;
    ELSE
    RETURN 0;
    END IF; /** vDoesItExist > 0 **/
    END check_fg_id;

  • How to do IF THEN  ELSE logic in Workflow?

    I need to do "if then else" logic in Workflow. The key part of the probem is that there are several "else" (elsif) possibilities, so I can't use a Boolean or Yes/No as a return result code. When I use a function, I can't see a way to "check" the value before it passes to a next process. HELP!

    Whether you are using a function as your comparator or the Standard WF Compare Operators, this can be done. I will explain two scenarios, one with your own written functions as the comparator and the other using the standard Compare Text function.
    Create a PL/SQL procedure that returns a boolean. In this procedure you would pull two attributes from the workflow, the test case and the value you want to compare to. You would check to see if they are equal and return true, otherwise false. I do not know what you are trying to compare in your if statement, but whatever it is, if its true, return true, otherwise false.
    Now in the workflow, you would put a couple of these in your process diagram representing each if statement. Set the two (or more) attributes in the Node Attributes tab of each function node to the values you want to compare. For the first node, have the <true> transition go to whatever you want done and then to an END node. Have the <default> or <false> transition point to the next function node you have. Do the same for each one except at the last one, its only transition would be <default> and that would go to END. This way if the first function resolves true, it will do whatever should be done and then skip the rest of the conditions. If its false, it will go to the next conditional. The last one will be gotten to only if every other conditional was false that would be your final else statement.
    To do this with the Compare Text option, have the same set up in your workflow diagram exception have the <EQUALS> be your true path and the <DEFAULT> transition go to the next compare text node.
    -->O-{default}->O-{default}->O->default
         |                 |                 |             |
        true           true            true           |
         |                 |                 |             |
      doWork     doWork     doWork      else
         |                 |                 |             |
          ---------------->---------------->------------|
                                                          |
                                                      end

  • How to write IF-THEN-ELSE in query (syntx)

    Dear Experts,
    As the decode syntx is Oracel's, is there any syntx could be used for IF-THen-Else function in query generator?
    Thanks.
    Emily

    Morning, Gouri,
    It works!!  Thanks very much!
    BTW, in Inventory menu, the report 'Inventory Posting  List, does it pull data from table 'OINM' ?
    It looks like OINM does not link with tables of ODLN (PL/delivery) and OPOR (PO), is it correct?
    If I would like link OINM to ODLN and OPOR, which table interrelated between them??
    Pls kinldy asdvise.
    Thanks in advance.
    Emily

  • Switch function keys and Fkeys

    The default use of the F-keys is for the functions such as brightness and volume. How do I switch function keys and F-keys so the F keys are the default, especially for programs that I can assign custom keystrokes such as in Adobe InDesign. Thanks

    Hi, Shut down the notebook.  Tap away at the esc key as you start the notebook to enter the Start-up Menu.  Select the Bios option ( f10 ), then make the change shown in the document on the following link. http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02035108&cc=us&dlc=en&lc=en&jumpid=reg_R1002_US... Regards, DP-K

Maybe you are looking for

  • SAP XI vs Oracle BPEL/ESB/SOA

    Hi, Wondering!  What would the percentage of implementations SAP XI vs Oracle BPEL/ESB/SOA for next couple of years.  I just wanna explore and know more about them..  How's XI doing in terms of new customers/implementations and what are all market tr

  • How to load a project with Eclipse

    Ok, I'm new to eclipse, and I know this may seem like a dumb question, but how do you load a project you've already been working on? I don't see any "open project" menu item to click on in Eclipse, all I see are "new..." everything.

  • Web Code Review - How do you complete it?

    We have been using VSO and VS2013 for a while now and can happily complete code reviews in visual Studio. The code review email offers a link to perform the code review online via Web Access. I can open the review and see all the changes but I cannot

  • Installing VISTA and creating the one key recovery

    Hi,      Is it possible to install VISTA on my system and create one key recovery as done in the Lenovo Care for the windows XP. I have Lenovo 3000 N100 07686KU system. Thanks

  • LV 7.1 application builder

    Is it possible to make an executable with LV 7.1 that would run by itself on any other machine? - If not, I guess I need to install run-time engine. How do I install run-time engine? Thanks, Jerome.