Solved
Forum Discussion
Hello @sg_sripathi, good question and yes this can be done.
Inject the expression utility class:
@Inject
private ExpressionUtils expressionUtils;
String pipeLabel;
then in the configure()
method:
@Override
public void configure(PropertyValues propertyValues)
throws ConfigurationException {
Document emptyDoc = documentUtility.newDocument();
pipeLabel = expressionUtils.createExpressionProperty(
propertyValues, true, "pipe.label").eval(emptyDoc);
}
And then you can just use the variable when writing an output document e.g.:
Map<String, String> data = new LinkedHashMap<String, String>() {{
put("pipeLabel", pipeLabel);
}};
outputViews.write(documentUtility.newDocument(data));
The Mapper Snap can be used to validate whatever expression value you are trying to use in the custom Snap: