webMethods

webMethods

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
  • 1.  Checking for variable existence in pipeline

    Posted Tue March 25, 2003 11:43 AM

    (b2b Integrator Version 4.0.2) I’m mapping one string value from the Pipeline-In to a string value in the “From Item” record of the AppendToRecordList service and simultaneously defaulting a string value in the “From Item” record as well. Ideally I would like to only map the value from the Pipeline-In and default the string value if the Pipeline-In variable is not $null.


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 2.  RE: Checking for variable existence in pipeline

    Posted Wed March 26, 2003 02:24 AM

    There are two things

    1. Defaulting a value
    2. Conditional Mapping

    Create a MAP operation and assign a value to string variable. Uncheck ‘Override pipeline value’
    . This will default a value to the variable.

    For conditiona mapping (i.e. ‘Copy only if’ ) have a variable that holds value for condition, lets say a variable ‘con_var’ that holds value ‘1’. On map specify condition (‘Copy only if’) “%con_var% > 1”

    Parvez Purkar


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Checking for variable existence in pipeline

    Posted Wed March 26, 2003 07:30 AM

    Use a Branch construct, using the variable as the character you branch on. Use 2 Sequence constructs under the branch with $null as the first label, $default as the second. Code the map accordingly.

    BRANCH on ‘/variable’
    $null: SEQUENCE


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 4.  RE: Checking for variable existence in pipeline

    Posted Wed March 26, 2003 10:29 AM


  • 5.  RE: Checking for variable existence in pipeline

    Posted Thu March 27, 2003 10:37 AM

    Looks like you have a solution that works, but here’s another angle. I think the problem is that you’re trying to do the default setting and the condition map copy at the same time, and the default setting is always “winning”.

    Try doing a MAP of the default value to “fromItem” first. And then do the conditional copy in the INVOKE. Some of the expressions you list may work. Another would just be:
    variable != $null


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 6.  RE: Checking for variable existence in pipeline

    Posted Thu March 27, 2003 06:10 PM

    Hi Kevin,

    As this thread points out, there are several ways to do it, but here is what I think is most elegant:
    You have an invoke of AppendToStringList (I assume it is string, not record list).

    1. Draw your map line from your variable to the fromItem.
    2. set the Copy-only-if to be ONLY the variable name example: %myVariableName% (this will copy only if the variable exists), and I doubt it is even really necessary–but it needs to be conditional to allow you to also do a set-input on the fromItem.
    3. set-input to the default value on fromItem(i.e. ‘UNKOWN’ or whatever you want it to be). UNCHECK ‘Overwrite pipeline value’.

    Voila, you’ve set the default and mapped all in one line.

    Marilyn


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods