There are times when you need to get one particular element from an array, but not based on the index. This item needs to fulfill some requirements like equality and so on. In order to perform that task selector, “?” was introduced. This is applicable for both DataWeave 1.0 and 2.0.
Syntax
Below, you can find the syntax for selecting an element of an array by a condition. This operation accepts array as an input and returns array as well. In the square brackets, we specify a condition that item needs to fulfill. First, we use the selector “?” sign, and after that, in parenthesis, we put condition. In order to check something against item property, we can use “$” variable to access the item. If we would like to get the item by isAvailable property, we would write something like this: $.isAvailable. https://goo.gl/iLThAU #DataIntegration #ML
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on Reddit (Opens in new window)