2

I want to set a variable based on the output in Mule 3.

For example the check I want to do is if there is any payload I want to set the var value to this ${http.path.one} else ${http.path.two}. In Mule 4 it can be done in multiple ways but in Mule 3 seems little tricky. Has anyone an idea how to implement this in Mule 3?

aled
  • 21,330
  • 3
  • 27
  • 34
Makavelines
  • 111
  • 6

1 Answers1

4

In Mule 3 DataWeave you can use when/otherwise instead of Mule 4 if/else. To access the properties use the p() function. Depending on the exact payload and the condition you need you may need to tweak the expression for the condition.

Example:

p('http.path.two') when (payload != null) otherwise p('http.path.one')
aled
  • 21,330
  • 3
  • 27
  • 34