-1

how can be this done if I have string like this.

"Processing of job {$jobName} started ${yyyy-MM-dd}"

To get

"Processing of job test-job started 2022-10-11"

Thanks!

Root
  • 1
  • From where are you getting the values of `jobName` and `yyyy-MM-dd`. Are they maintained in a property file? of are they coming from a JSON? – Harshank Bansal Oct 11 '22 at 08:32
  • jobName I get from payload stored in vars.jobName. yyyy-MM-dd should be autogenerated from now() – Root Oct 11 '22 at 08:49
  • Can there be more variables? or is it just `jobName`. If there are more, is this statement true that the placeholder value will ALWAYS be equal to the variable name? – Harshank Bansal Oct 11 '22 at 09:18

1 Answers1

0

I would recommend to use DataWeave string interpolation. Syntax is somewhat different:

%dw 2.0
output application/java
var date=now()
---
"Processing of job $(vars.jobName) started $(date as String {format: 'yyyy-MM-dd'})"
aled
  • 21,330
  • 3
  • 27
  • 34