Filter
In our previous crash course on the Platform level, we covered filtering within data transformations and discussed the validation filter, a key component for any data transformation flow. In this microlearning, we will take a closer look into the filter options available in eMagiz and explore how they can be effectively utilized when building a flow.
If you have any questions along the way, feel free to reach out to us at academy@emagiz.com.
1. Prerequisites
- Basic knowledge of the eMagiz platform
2. Key concepts
This microlearning centers around filter options in eMagiz flows.
- With filter we mean: The ability to determine on a per-event basis whether the event (i.e., message) is allowed to continue or not.
3. Filter
In cases where you need to determine if a message (a piece of data) can continue or not you should use one of the filter options that eMagiz provides you.
eMagiz comes with three filter options:
- XML Validating Filter
- Standard Filter
- XPath Filter
The first option is already discussed in the Crash Course * Platform so we won't look into that option any further in this microlearning.
Below we will analyze the remaining two options to see how you can use these options to determine whether a message may continue or not
3.1 Standard Filter
The standard filter is the filter that is the most flexible and because it is the most flexible also the most complex to implement if you do not know what you are doing.
With the standard filter, you have two options to determine your filter. You either use a SpEL expression.
A widely used example of such an implementation is the filter in the routing to control when data is allowed to travel to the offramp.
Or you use a Groovy script. A Groovy script is a piece of programming code that is executed for each incoming message, that can in turn use any third-party Java library.
In essence, this filter evaluates the SpEL expression or Groovy Script to see what the result is. If the result is true the message may continue. If not it will be dropped.
3.2 XPath Filter
The XPath filter can only be used to filter XML messages. As this filter is more narrow in scope it is also easier.
Think back to what we learned in the crash course * platform with regards to XPath. The same logic applies in this case.
With the help of this filter, you can filter messages based on the evaluation of an XPath expression
In this example, we want to validate that at least one Project is available in our CDM message
To do so we need to fill in the correct XPath and place the component at the correct place within the flow.
Once again, don't forget about the namespace
4. Key takeaways
- eMagiz provides three distinct filter options for managing data flows:
- XML Validating Filter
- Standard Filter
- XPath Filter
- Each option comes with a specific function, choose the appropriate filter based on the type of data and the complexity of your filtering needs.
5. Suggested Additional Readings
If you are interested in this topic and want more information on it please read the help text provided by eMagiz when executing these actions and read the following links: