Add Attributes Step
Adds new attributes to your data flow using ONE expressions.
|
This step is available for all transformation types: standalone plans, embedded plans, transformation rules, and transformation catalog items. |
Overview
The Add Attributes step creates new columns in your data flow by evaluating expressions. Use this step when you need to derive new values from existing data, add calculated fields, or create constants.
Use this step to:
-
Combine multiple attributes into a single value.
-
Calculate derived values (totals, averages, percentages).
-
Add constant values or flags to your data.
-
Format or transform existing data into new attributes.
-
Create lookup keys by combining multiple fields.
Configuration
Add an attribute
-
In the step configuration, select Add expression.
-
Configure the new attribute:
-
Attribute name: Enter a name for the new attribute. Use clear, descriptive names that indicate the attribute’s purpose.
-
Data type: Select the appropriate data type (String, Integer, Long, Double, Boolean, Date, Datetime).
-
Expression: Define the value using a ONE expression.
-
-
Select Add expression again to add additional attributes as needed.
Expression examples
trim(first_name + ' ' + last_name)
Creates a full name by combining first and last name, trimming whitespace.
iif(total_tasks = 0, null, round((toFloat(completed_tasks) / toFloat(total_tasks)) * 100, 2))
Calculates completion percentage with type conversion and division-by-zero protection.
iif(amount > 1000, 'High', 'Standard')
Assigns a category based on a condition.
datePart(order_date, 'YEAR')
Extracts the year component from a date field.
region_code + '-' + toString(customer_id)
Combines multiple fields into a single key value.
'PROCESSED'
Adds a static value to all records.
Best practices
- Use descriptive attribute names
-
Choose names that clearly indicate what the attribute contains. Avoid generic names like
new_columnorcalc1. - Match data types to expressions
-
Ensure the selected data type matches what your expression returns. A mismatch can cause errors or unexpected results.
- Handle null values
-
Consider what should happen when input values are null. Use functions like
coalesce()orisnull()to provide default values. - Keep expressions focused
-
Each attribute should serve a single purpose. Complex logic is easier to maintain when split across multiple attributes.
- Test expressions
-
Use the expression testing feature to validate your expressions before running the full transformation.
Comparison with Transform Data step
| Aspect | Add Attributes | Transform Data |
|---|---|---|
Purpose |
Creates new attributes |
Modifies existing attribute values |
Original data |
Preserved (new columns added) |
Overwritten (values replaced) |
Use case |
Derive new values while keeping originals |
Clean or standardize existing values |
Was this page useful?