Filter Transformation
Overview
The Filter transformation object in Astera is used to filter out records based on some pre-defined rule. The records that match the specified rule are filtered out and can be mapped further in the dataflow whereas the records that do not satisfy the specified condition are omitted. The rule or logic to filter out records from data can either be chosen from an extensive library of built-in functions or you can write one of your own.
Filter transformation is quite similar to Data Quality Rules in its functionality. However, unlike Data Quality Rules, which return an error or warning when the rule condition fails while still passing the record downstream, the Filter transformation will completely filter out any such records. The filtered records, as well as their status will not be accessible to any downstream object on the dataflow, including any type of log.
Video
Use Case
In this case, we have Customers data for a fictitious organization stored in a Delimited file source. We want to filter out the records in which:
Country = Germany
Contact title = Owner
To filter out these records from our source data, we will use Filter transformation object and write the relevant expression in the Expression Builder to achieve our desired output. We will then write our filtered output to a Fixed length destination.
How to Work with Filter transformation
Retrieve your source data by using the relevant source object from the Sources section in the Toolbox. In this case, our sample Customers data is stored in a delimited file so we will be using a Delimited file source object to retrieve this data in the dataflow.
Next, drag and drop the Filter transformation object from the Transformations section of the Toolbox to the designer and map fields from the source object to the Filter transformation object.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FfwUBwNN28EY5KHxwL8sB%252Fgif-drag-and-drop-1579580296242.gif%3Falt%3Dmedia%26token%3D80c4c5e6-7e09-4306-9e88-9c6346437b60&width=768&dpr=4&quality=100&sign=e79d5735&sv=1)
Right-click on the Filter transformation object and select Properties.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FQsQjqd4VknuiBtsLZ5q8%252F1.png%3Falt%3Dmedia%26token%3D71cd4e33-24b2-47fb-ab56-324d6ac21bc4&width=768&dpr=4&quality=100&sign=8b3b3fcf&sv=1)
A Layout builder window will now open. Here you can modify fields and the object layout.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252Fa4Ghik4kMTxZ2Jx3gGsd%252F2.png%3Falt%3Dmedia%26token%3D3ad81e74-3534-4793-8c0d-246b3383be94&width=768&dpr=4&quality=100&sign=24ae1ef9&sv=1)
Click Next. This will take you to the Filter Transformation Properties window. Here, you can see the following three sections:
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FYMEt2kCbXlfu35oshtTj%252F3.png%3Falt%3Dmedia%26token%3D0566554d-a0e8-43bc-b8d0-731ba5f5182b&width=768&dpr=4&quality=100&sign=dcc9c7c1&sv=1)
Functions: An extensive library of built-in functions organized in various categories. From here, you can select functions according to your requirement.
Expression: The filter expression will appear in this Expression box. You can either write your own expression or choose from the built-in functions library.
Objects: Contains the object layout. You can double click on any element in the layout to write it in the Expression field.
In this example, we want to filter out records of customers with the ContactTitle, ‘Owner’, and Country, ‘Germany’. For this, we will write the following expression in the Expression box:
Country = “Germany” and ContactTitle = “Owner”
After writing the expression, click on the Compile button to check if the expression is correct. If the Compile Status is Successful, the expression is correct. If not, then you need to check and rectify your expression before proceeding to the next window.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FqFBjRs0PtALuyQqtqcHl%252F4.png%3Falt%3Dmedia%26token%3Dc4d15917-4986-48ce-aa18-ff16832b2e48&width=768&dpr=4&quality=100&sign=2a80fc6c&sv=1)
Click Next. This will take you to the Config Parameters window where you can further configure and define parameters for the Filter transformation object.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252F94pzAOJ5Ow3nUoHhigxZ%252F5.png%3Falt%3Dmedia%26token%3Dd02b23c6-1509-4ba3-8969-2448fd5633c4&width=768&dpr=4&quality=100&sign=c5022593&sv=1)
Click Next to proceed to the General Options window. This window consists of options common to most objects in a dataflow, such as:
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FGWL95UGXI4jRXTKFV2ih%252F6.png%3Falt%3Dmedia%26token%3D4e78bd0a-a9c5-4c45-ac4a-4657ea022142&width=768&dpr=4&quality=100&sign=45a017de&sv=1)
Clear Incoming Record Messages: When this option is checked, any messages coming in from objects preceding the current object will be cleared. This is useful when you need to capture record messages in the log generated by the current object and filter out any record messages generated earlier in the dataflow.
Do Not Process Records with Errors: When this option is checked, records with errors will not be outputted by the object. When this option is unchecked, records with errors will be outputted by the object, and a record message will be attached to the record. This record message can then feed into downstream objects in the dataflow, for example a destination file that will capture record messages, or a log that will capture messages, as well as collect statistics.
The Comments input allows you to enter comments associated with this object.
The Filter transformation object has been configured. Click OK.
To preview filtered records, right-click on the Filter transformation object and select Preview Output.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252Fv5BbVxpMBTv8IChm6UO0%252Fgif-preview-output.gif%3Falt%3Dmedia%26token%3D1f9084e1-dac0-4359-bf13-9cc887a8055f&width=768&dpr=4&quality=100&sign=7eaab1eb&sv=1)
The output would look like this:
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252F7l0UMkDF2iOuwJlslsd4%252F8.png%3Falt%3Dmedia%26token%3D9c2b5d36-0ada-452d-9506-e1ba8c97a80b&width=768&dpr=4&quality=100&sign=2a27f3f0&sv=1)
You can now write your output to a destination or further transform it by applying some transformation.
In this case, we will write our output to a Fixed Length file destination.
Rename your destination object by double-clicking its header. Here, we will rename it as German_Customers.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FHyBCNlwsaZiEkUPIZ8Jj%252F7.png%3Falt%3Dmedia%26token%3Dee8f0168-7d83-4575-a697-79993c44f583&width=768&dpr=4&quality=100&sign=42f10470&sv=1)
This concludes using the Filter transformation object in Astera.
Last updated