Constant Value Transformation

Overview

Constant Value Transformation returns a single, predefined value for all records in a dataset.

Video

Use Case

In this example, we have an excel worksheet containing Employees’ data. The data is being written to a database table. The database table contains an additional field that stores department information. We want to pass a constant value to the Department field. To do this, we will use the Constant Value transformation object in Astera. Constant Value transformation will be mapped to the Department field to append the name of the department with the final output.

How to Work with Constant Value Transformation

  1. Drag-and-drop an Excel Workbook source from the Sources section in the Toolbox.

Read: How to work with an Excel source

  1. Select a destination object from the Destinations section in the Toolbox. This is where the transformed data will be written and stored. We will use a Database Table Destination.

Read: How to work with a Database destination

  1. Map the Employees dataset from the source object to the destination table, Employees_Database.

Note: There is an additional field (Department) in the destination object, but there is no such field in the incoming dataset. To append the Department field to the final output, we will use the Constant Value transformation object.

  1. Now, drag-and-drop the Constant Value transformation object from Toolbox > Transformations > Constant Value.

  1. Right-click on the Constant Value transformation object and select Properties.

  1. The Constant Value Map Properties window will now open. Here you will see a Constant Value section where you can write any value to be appended to your output dataset.

In this case, the value will be ‘Marketing’, to specify the department of the employees in the source dataset.

  1. Click Next. A General Options window will now open. Click OK.

General Options window:

This window shares options common to most objects in the dataflow.

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 output by the object. When this option is off, records with errors will be output by the object, and a record message will be attached to the record. This record message can then be fed into downstream objects in the dataflow, for example a destination file that will capture record messages, or a log that will capture messages and collect statistics as well.

Your transformation object will now look like this:

  1. Now map the Value field from the Constant Value object with to the Department field in the Employees_Database destination object.

  1. Right-click on the Employees_Database destination object and click Preview Output.

Your final output will look like this:

The Department field from our source dataset has been successfully appended with specified records in the final output, through the use of a Constant Value transformation object.

Last updated

© Copyright 2023, Astera Software