I have properties as below
path.order=/order
path.address=/address
Usually we will use ${path.order} to get the key value. I want to pass the type(order or address) dynamically to get the key value. Like below
${path.#[flowVars.type]}
I tired with above expression. It did not work. can you please help on this to prepare and get the key dynamically
Your requirement can be achieved using dataweave function. I am posting a snippet. I tried concatenating withing the final dw expression, but it didn't work. Let me know if this fulfills your requirements.
<message-properties-transformer scope="invocation" doc:name="Message Properties">
<add-message-property key="type1" value="address"/>
<add-message-property key="type2" value="object"/>
</message-properties-transformer>
<message-properties-transformer scope="invocation" doc:name="Message Properties">
<add-message-property key="property1" value="#['path.' + flowVars.type1]"/>
<add-message-property key="property2" value="#['path.' + flowVars.type2]"/>
</message-properties-transformer>
<logger message="#[dw('p(flowVars.property1)')]" level="INFO" doc:name="Logger"/>
I have written a post on this here, as well.