Filter Data Values
Filter Data Values is a tool in Nappai that lets you sift through a list of data items and keep only the ones that match a specific rule. You tell it which field to look at, what value you want, and how to compare them, and it gives you two lists: the items that matched and the ones that didn’t.
How it Works
The component reads each item in the input list and checks the value of the field you specify (the Filter Key).
It then compares that value to the Filter Value using the operator you choose in Comparison Operator (for example, “equals”, “contains”, “greater than”, etc.).
If the comparison is true, the item is added to the Filtered Data list.
If it is false, the item goes into the Rest of Data list.
You can also narrow the search to specific keys by providing a regular expression in Regex Filter; only keys that match the pattern are considered.
The whole process happens inside Nappai, so no external services are called.
Inputs
- Input Data: The list of data items you want to filter.
- Filter Key: The name of the field in each item that you want to examine (e.g., “route”).
- Filter Value: The value you want to compare against (e.g., “CMIP”).
- Comparison Operator: The rule that decides if an item matches (e.g., “equals”, “contains”, “starts with”).
- Regex Filter: A regular expression that limits which keys are checked (e.g., “route.*”).
Outputs
- Filtered Data: A list that contains only the items that met the filter criteria.
- Rest of Data: A list that contains all the items that did not meet the filter criteria.
These outputs can be fed into other components, such as a “Send Email” component or a “Save to Database” component, to continue your workflow.
Usage Example
Imagine you have a list of shipment records and you want to find all shipments that are going to the “CMIP” route.
- Drag the Filter Data Values component onto the canvas.
- Connect the output of the component that supplies the shipment list to Input Data.
- Set Filter Key to
route
. - Set Filter Value to
CMIP
. - Choose
equals
for Comparison Operator. - Leave Regex Filter empty (unless you need to target multiple keys).
- Connect the Filtered Data output to a “Send Email” component to notify the team, and connect the Rest of Data output to a “Log” component to keep a record of non‑matching shipments.
Related Components
- Sort Data – Arrange items in a specific order.
- Group Data – Group items by a common key.
- Transform Data – Modify or enrich data items.
Tips and Best Practices
- Double‑check the Filter Key spelling; it must match exactly what’s in your data.
- Use the Regex Filter sparingly; complex patterns can slow down the filter.
- Test your filter on a small sample first to confirm it behaves as expected.
- If you need to filter on multiple keys, use a regex that matches all of them (e.g.,
route|destination
).
Security Considerations
- Be careful with the Regex Filter: poorly written patterns can cause performance issues or unintended matches.
- The component only processes data that you provide; it does not send data outside of Nappai.