Recursive Variable Substitution

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


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

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.

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


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


Any ideas?



%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…


> 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:

Something more general purpose gets hairier and would need to be tested throughly.
For eg:


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

eg : I create a document like this :
|_ %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…


where i can find getFldValueFromDocData ?

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.

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…