Description
The Filter component is a component that filters the data that passes the contents of the input payload to the next component and outputs it to the output payload.
You can enter a conditional expression that allows you to pass a test if it's true, or not.
The conditional expression is written with variables with tp. / tv. / ap. / av. / cp. / cv. prefixes as comparison targets.
| Condition Example | Formula |
|---|---|
| Payloads are targeted and Payloads are numerical in nature | cv.Payload > 10 |
| String | cv.Payload =~ "^abc" |
| JSON Array | cv.Payload[1] > 10 |
| JSON Object | cv.Payload.key1 == "abc" |
The expression field supports basic operators such as ^ to indicate the start of a string.
Component Properties
| Name | Description |
|---|---|
| Condition | Write a conditional expression |
Available Modifiers
| Modifiers | + - / * & | ^ ** % >> << |
|---|---|
| Comparators | > >= < <= == != =~ !~ |
| Logical Ops | || && |
Examples
If you like the action to stop unless the JSON value book_id of the first book in the books array in tv.Data payload is set to 12345, you can use a Comparator, for example tv.Data.books[0].book_id == 12345
You can also use pre-mapping to prepare the data for the filter component. For example: