Using Variable Substitution from database field

I am using wM 6.0.1 and the JDBC adapter service to select a format for an email message I would like to send out. When I get the format from the database, I want to be able to combine the format with the values in the pipeline to perform variable substitution for my email message. I want to be able to modify the format in the database to modify what goes into my email (what fields from the pipeline):
database field: format= %email/subject%%email/body% where email is my document name.

I populate the document, EMAIL, with values and I want to be able to do something like a MAP step using variable substitution to combine the format with the values from pipeline.

Has anyone done anything like this? I can’t get the variable substitution to work.

I want to be able to do what the wMTN_BuildingYourNetwork.pdf describes on page 328-329.
C:\webMethods6\TNConsole\doc

Philip,
I believe you have 2 different fields “email” and “subject” in pipeline. So you can either concatenate both the fileds before you actually pass on to the format so that “email/subject” appears as a single field. OR you need to do is %email%/%subject% and %email%/%body%.

Hope this helps.
RC

Let me try to clarify a little bit more what we are trying to do. In our pipeline, we will have a document called email. Email will contain the fields subject, system name, server id, basically all of the fields necessary to compose an email message. Now, instead of hard coding the format of the email message in flow service (body = %email/systemName%%email/serverId% etc. we would like to store the format of the email message in the database so we can change the format of the email message on the fly. For example, we can automatically change the format of the email message body to the server id being first instead of the system name: %email/serverId% %email/systemName%.

Has anyone done anything like this? I can not get the variable substitution to work when grabbing the format from the database. Any help would be greatly appreciated. Thanks!

The simplest solution is to use regular string formatting instead of the pipeline substitution. In your service, get the format from the database and then use the string formatting functions to put all the values together. You probably want to use pub.string:messageFormat to do this - it should work just like the Java message formatting functions. Then your email body is just the output of the messageFormat call.