Skip to main content
Filter Mapper Step

Filters remove records that do not match a selection function.

Praise Magidi avatar
Written by Praise Magidi
Updated over 7 months ago

A basic function in working with data is filtering out records that are not required and only working on those that are. In SQL, this is generally achieved through a WHERE clause, and in Javascript arrays the Array.filter() function.

In Synatic, the same concept exists. It works similarly to the Javascript function in that the Javascript can be configured to test each record passing through a Flow.

Adding a Filter Mapper Step

To add a Filter Mapper step in a flow, follow the below instructions:

1. Click on the highlighted icon as shown in the below image.

2. The below page will appear. Select or search for a step to pull out the source data. Click on Filter as shown in the image below.

Configuring the Filter Mapper Step

Illustrated in the below image is the configuration that is available in the Filter Mapper step.

JavaScript Code

The code block has access to the processing object, which is accessible through the input parameter. Normally, in the case of a filter, the property of interest is the input.record property. This is the JSON representation of the current record being processed.

At this point, check the fields of the input record and filter accordingly. Returning true allows the record to pass the filter, and return false filters out the record.

Discard Record Checkbox

  • Selecting "Discard Record" removes the record from memory entirely. Use this option when working with huge in-memory data sets to improve performance. The record will not appear in the flow or logs etc.

  • Not Selecting "Discard Record" marks the record as Skipped. It is not available anywhere in the processing flow but will appear in logging and error messages (if any).

Example

The image below shows the original data used in the Record Generator Step.

The image below shows a JavaScript Code in the Filter Mapper step. In this example, the records are filtered according to 'Availability' and 'Flowers' using operators (highlighted in yellow in the above image).

The image below shows the data after the Filter Mapper step. Only records with the specified filters are displayed i.e. Available and White Roses.

For more information, click on the link below:


Useful Tutorials

Revisit the Getting Started page for a refresher.

Read more about Steps here.

Did this answer your question?