2

I am trying to fetch value from the properties file

"mykey" = "value"
"mykey1" ="value2"

in mule, we can fetch the value by ${mykey}, but what if mykey is stored in a variable named keyName. I tried fetching the value by writing ${(#vars.keyName)} . But it is not working

HMT
  • 2,093
  • 1
  • 19
  • 51
  • My understanding is you have a property file on your classpath in your mule project. You want to use the property value inside the dataweave script . Right ? – Alan M Jan 07 '20 at 15:27

3 Answers3

1

You can use #[p(vars.keyName)] to retrieve value for key stored in variable keyName from a property file.

Amit Jha
  • 11
  • 1
1

You should be using Mule::p, just p could get deprecated in the future.

%dw 2.0
output application/java
var myPropName = "test"
---
Mule::p(myPropName)
George
  • 2,758
  • 12
  • 16
0

You can use the p function: https://docs.mulesoft.com/mule-runtime/4.2/dw-mule-functions-p

p('mykey')