← All articles
MuleSoft

Mule 4 - Implement "Not - Contains" Condition

MuleSoft has recently launched Mule 4 which is really powerful especially when MuleSoft decided to use DataWeave as the main expression language. Recently, I was working on upgrading one of our project with Mule 4 and I had to implement "not-contains" condition.

Hmm.. this was tricky as some of the things that I tried did not really work; but at the end solution was really simple. Here is what I tried:

DescriptionExampleResult
Using "not" operator
...
Not Working
Using "!" operator
...
Not Working
Using "if-else"
...
Working!
As you see, third implementation works perfectly. We can enhance "if" condition to add more conditions as needed.