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.


#TechXchangePresenter
 View Only
  • 1.  Copy condition

    Posted Tue February 08, 2011 10:23 AM

    Hi

    We are using a transformer to do value transformation, and for the input variable we have a copy condition specified. We want the mapping to be executed if a varibale say ‘a’ exist, if not it should use the hardcoded value.

    Please let me know how to check if the variable exist in the pipeline and how to use it as a copy condition.

    Regards,
    Murali


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


  • 2.  RE: Copy condition

    Posted Tue February 08, 2011 03:59 PM

    Determine which value to pass before calling the transformer. I don’t think you’ll be able to do what you’re after via copy condition.


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


  • 3.  RE: Copy condition

    Posted Wed February 09, 2011 08:23 AM

    Existence of variables in conditions is checked by just entering the variable name inside two %, so the existence of var is checked by %var%, the nonexistence by !%var%.
    See Deveopers Users Guide Appendix D. Conditional Expressions - Checking for Variable Existence.

    Afaik it is not possible to set a copy condition for a constant. But if you map you default value to a pipeline value in a step before you call the transformer, say defaultvar, and the varavle you want to check is a, the copy condition to check the existence is just %a%.

    So draw a mapping from a to you transformer and enter the copy condition %a% and a mapping from defaultvar and set it’s copy condition to !%a%


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


  • 4.  RE: Copy condition

    Posted Wed February 09, 2011 10:12 AM

    Guys,

    Is anybody able to give an example for this one.

    Thanks,
    Sreenivas


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


  • 5.  RE: Copy condition

    Posted Wed February 09, 2011 04:34 PM

    I would recommend against using copy conditions for this. I’m not a fan of using copy conditions in general. They make reading and maintaining the code harder for no real benefit. The approach mwroblinski describes most definitely works but one should consider the readability and maintainability aspects of the approach.


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


  • 6.  RE: Copy condition

    Posted Thu February 10, 2011 09:45 AM

    Map the variable eg: “a” to “c”. now click on the map and give the condition statement in the Copy condition in property window. eg : %a%!=null . Now in the pipe line hardcode the value using “SetValue” to “c” with a constant .


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


  • 7.  RE: Copy condition

    Posted Thu February 10, 2011 01:00 PM

    If you wish not to use a copy condition then you could give this simple overwrite method a try.

    1. Initialize a variable ‘var1’ hardcoded with whatever default you need.
    2. Map variable ‘a’ to ‘var1’
    3. Map ‘var1’ input of the transformer.

    Since the variable ‘a’ is not in the pipeline the step 2 map will not happen.

    Remember this would work only if you are sure you want to check for the existence of variable ‘a’ not if ‘a’ carries a null. Existence and Null value are different.

    Again the readability and maintainability aspects of this approach is something you need to consider and decide.


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