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

Recursive Variable Substitution

  • 1.  Recursive Variable Substitution

    Posted Thu April 08, 2004 12:20 AM

    Is there a way to perform recursive variable substitution
    For eg,

    %doc[%$iteration%]%

    I could not make this work. I believe webMethods should have such trivial things. I added the parenthesis and tried…but could not make it work…Its urgent. Please let me know if there is any other roundabout way


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


  • 2.  RE: Recursive Variable Substitution

    Posted Thu April 08, 2004 03:05 PM

    Looks like you have to map the variable and do the appropriate indexing (blue line). webMethods allows pipeline variable substitution (%index%) when you are indexing.


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


  • 3.  RE: Recursive Variable Substitution

    Posted Tue April 27, 2004 09:01 PM

    Along this line, is there a way to perform multiple variable substitutions on a variable? For example,

    %Document/%DocumentType%/IDOC/EDI_DC40/SNDPRN%

    In this example, I need to substitute “DocumentType” and then perform the variable substitution on the string with the “DocumentType” substitution as such:

    Document/INVOIC01/IDOC/EDI_DC40/SNDPRN

    Any ideas?

    Thanks,
    Dave


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


  • 4.  RE: Recursive Variable Substitution

    Posted Tue April 27, 2004 09:41 PM

    Dave,

    %Document/%DocumentType%/IDOC/EDI_DC40/SNDPRN% is actually below after processing: DocumentType since variables (Document/ and /IDOC/EDI_DC40/SNDPR) are null. variables can not be nested…as far as I am aware…but you can do loop for multiple documents within the parent document or given the document type value, you can branch transformations accordingly based on the document type. My 2 cents…
    Hope it helps…

    J-


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


  • 5.  RE: Recursive Variable Substitution

    Posted Thu April 29, 2004 06:41 AM

    > Is there a way to perform recursive variable substitution
    > For eg,
    >
    > %doc[%$iteration%]%

    The problem with this is webMethods variable names are pretty loose (pretty much anything except tabs or newlines)

    For eg: you can have a variable named ‘]’ with value ‘3’.

    About simple nested tags, it is possible to write a general purpose routine to detect the innermost pair of tags, then pickup the correponding value from the pipeline, then substitute it using pub.string:replace.

    For eg:
    %test[%$iteration%]%

    Something more general purpose gets hairier and would need to be tested throughly.
    For eg:
    %outer%middle%inner%%%
    %outer%middle_1%%middle_2%%


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


  • 6.  RE: Recursive Variable Substitution

    Posted Tue March 25, 2008 06:44 PM

    Hi,

    To perform a multiple variable substitutions on a variable you can use wm.fin.utils:getFldValueFromDocData.

    eg : I create a document like this :
    myDocument
    |_ %variable%_Example

    I want the value %myDocument/%variable%_Example%
    So I use getFldValueFromDocData whith I map “myDocument” to the document input of the service and I put %variable%_Example to the fldName input of the service with the option “perform variable substitution”.
    The result of this service give to me my entrie myDocument/%variable%_Example !! :slight_smile:

    Hope to be useful for someone…


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


  • 7.  RE: Recursive Variable Substitution

    Posted Thu October 21, 2010 09:21 AM

    hi,

    where i can find getFldValueFromDocData ?


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


  • 8.  RE: Recursive Variable Substitution

    Posted Thu October 21, 2010 08:36 PM

    wm.fin.utils:getFldValueFromDocData but it was in v6.5 of webMethods. I don’t know if this package is always present in superior version.


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


  • 9.  RE: Recursive Variable Substitution

    Posted Thu October 21, 2010 11:04 PM

    There is a service in PSutilities named “PSUtilities.string:substituteVariables” which does the recusrsive substituion… you can download this sample package and copy the service into your local machine…


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