GitHubContribute in GitHub: Open doc issue|Edit online

Scripting with Expressions

You can also use Expressions directly from JavaScript code. Here is an example that builds an Expression using the new ParameterSubstitution class:

var ps = new com.ibm.di.util.ParameterSubstitution("{work.FullName} -> {work.uid}");

map = new java.util.HashMap();

map.put("mc", main.getMetamergeConfig());
map.put("work", work);

task.logmsg(ps.substitute(map));

The expression that results from the JavaScript code issues the following log messages when run for several iterations in the test AssemblyLine:

14:35:29  Patty S Duggan -> duggan
14:35:29  Nicholas P Butler -> butler
14:35:29  Henri T Deutch -> deutch
14:35:29  Ivan L Rodriguez -> rodriguez
14:35:29  Akhbar S Kahn -> sahmad
14:35:29  Manoj M Gupta -> gupta