IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Branching on null/empty value and storing the result

  • 1.  Branching on null/empty value and storing the result

    Posted Sat September 20, 2008 01:39 AM

    Hi All,

    I am using the following steps in my flow service:

    1. Adapter service to retrieve data from a table—output is Tabledata

    2. Loop on TableData/results
      Now, there are some fields in the TableData output which may or may not have a value in each iteration of the loop. Say, one such field is AB.

    I want to store the TableData field values in another document in each iteration. But I want to store only those fields which have a value.

    For this, I am doing the following within the loop for the field AB:

    1. Branch on TableData/results/AB
      Map-Label $null—Don’t map the field to the document. This is for the case when the field has no value.
      Map-Label $default—Map the field to the document.
      This is the case when the field has a value.

    I have to pass this newly formed document to the input of an EDI mapping service.

    When I run the flow service, everytime the $default target step gets selected under the branch, irrespective of whether the field AB has a value or not.
    The $null target step is never getting selected.

    please help me in this regard.

    Thanks a lot
    Nishant


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 2.  RE: Branching on null/empty value and storing the result

    Posted Sat September 20, 2008 07:35 AM

    Try using the branch with evaluate lables to true and put “TableData/results/AB = $null” for first MAP step and default for second one. That should take care of it.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: Branching on null/empty value and storing the result

    Posted Sat September 20, 2008 04:32 PM

    Check the results/AB value to be sure it is null. Perhaps it is an empty string, which will not match with the $null label.

    If you want to not map null nor empty values, a regex label can do the trick. Use the following as the label for “not null and not empty and not just spaces”.

    /[^ ]/: MAP
    $default: do nothing


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: Branching on null/empty value and storing the result

    Posted Sat September 20, 2008 09:47 PM

    if you are using switch then make label as no value “no $null or any value” try with empty string. it works. because from database you are getting empty values not null values.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: Branching on null/empty value and storing the result

    Posted Wed September 24, 2008 04:19 AM

    Hi,
    Thanks for your reply. I tried the suggested logic, but now the default step is not selected even if there is no value in AB. Always, the step with the label “TableData/results/AB = $null” is getting selected. Please help me out.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services