Skip to main content

Filter (v2)

The Filter node in Automations v2 passes on the items that match its condition, and the items that do not match are not processed further on that path. Use it to process only the invoices with a positive total, to keep only the files received from one AS2 partner, or to exclude the rows a Transform node produced that have no customer number.

Filter accepts file items and data items, and the items it passes on are unchanged.

Filter is one of several ways to select items in an Automation. If you are not sure Filter is the right node, see Comparing Filter to Related Features below.

Settings

The node takes one Condition, a TransformScript expression without braces that evaluates to true or false for each item, the same as an If condition. payload.total > 0 passes on the data items or parsed files whose total is positive, and attributes.custom_metadata.as2_from == "Acme-AS2" passes on the files received from one AS2 partner.

An optional item-kind selection limits Filter to files or data before the condition is evaluated. With no kind selected, the condition applies to every item.

This lets a Manual trigger that supplies mixed files and data feed a file-only node such as Move File: select file kind, then use true to retain every file item or a condition to narrow them further. Items of the other kind never reach the condition.

Folder items also have file kind. When the next step needs regular files, attributes.is_directory == false excludes folders. Kind selection chooses files versus data; it does not test whether a file-kind item is a directory.

What the Next Node Receives

The next node receives only items of the selected kind, when set, whose condition was true. The selected kind also determines which kinds Filter's main output can deliver, allowing a connection to a consumer that needs just that kind.

Items excluded by kind or condition are not errors. Run detail shows the number of items the node passed on, as a count on the connection after it. When no item matches, the nodes after it receive no items and are Skipped.

Errors

When the condition cannot be evaluated for an item, that item fails. Error Handling rules on the node determine what happens to a failed item. A condition that is not a valid expression fails at save, and the message gives the position of the failing field in the JSON definition.

If and the trigger's file patterns also select items, and Content Validation also checks a file's contents against a rule you write.

Filter vs. If

If passes every item on, to its True path or its False path. Filter passes on only the matching items. Use Filter when the items that do not match need no further processing. Use If when they do.

Filter vs. the Trigger's File Patterns

A trigger's Incoming File Pattern and Exclude Pattern select files by their names and paths before the run has any items, and they apply to the whole run. A Filter node runs after earlier nodes, so its condition can use what those nodes added, for example the text an Extract node read from a document or the rows a Transform node produced, and it can apply to one path of a branched graph.

Use the trigger's patterns to select files by name. Use Filter to select items by their contents or by values another node produced.

Filter vs. Content Validation

Content Validation checks the files in an Expectation's delivery window against a TransformScript after the window closes, and it does not move or route a file. Filter tests each item while an Automation is running and passes on the ones that match. Use Content Validation to record whether a delivery was correct. Use Filter to process only the items that meet a condition.