SyncsField Transforms

Field Transforms

Field transforms let you modify, format, and reshape field values as they move from your model to a destination. They ensure the data arriving at each destination matches its expected format and semantics without changing your source data.

Field transform flow showing source data passing through transforms to produce correctly formatted destination data

Overview

When a sync runs, each row passes through any transforms you have configured before the data is written to the destination. Transforms operate on individual field values (or combinations of fields) and produce a new value for the destination field.

You can apply transforms to any mapped field in a sync. Zeotap provides a library of built-in transform presets organized by category, plus support for custom code transforms when you need complete flexibility.

Built-in Transforms

String Operations

TransformDescriptionParametersExample
UppercaseConvert text to uppercasealice@test.comALICE@TEST.COM
LowercaseConvert text to lowercaseALICE@TEST.COMalice@test.com
TrimRemove leading and trailing whitespace hello hello
SubstringExtract part of a stringStart position, Lengthalice@test.comalice (start 0, length 5)
ReplaceReplace all occurrences of a stringFind text, Replace text555-123-45675551234567 (find -, replace with empty)
Regex ExtractExtract a pattern matchPattern, Group (optional)user@domain.comdomain.com (pattern @(.+), group 1)
Pad LeftPad the start to a fixed lengthTarget length, Pad character420042 (length 4, pad 0)
Pad RightPad the end to a fixed lengthTarget length, Pad characterHiHi.. (length 4, pad .)
Split PartExtract the Nth segment after splittingDelimiter, Indexa-b-cb (delimiter -, index 2)

Date / Time Operations

TransformDescriptionParametersExample
Date FormatReformat a date or timestampOutput format2025-03-15T10:30:00Z03/15/2025 (format MM/DD/YYYY)
Date ParseParse a date string into a standard formatInput format15-Mar-20252025-03-15 (input DD-Mon-YYYY)
Extract PartExtract a component from a datePart (year, month, day, hour, etc.)2025-03-153 (part month)
Date AddAdd or subtract a time intervalAmount, Unit (days, hours, etc.)2025-03-152025-04-14 (add 30 days)
Timezone ConvertConvert between timezonesSource timezone, Target timezone2025-03-15 10:00 UTC2025-03-15 05:00 EST

Numeric Operations

TransformDescriptionParametersExample
RoundRound to N decimal placesDecimal places1234.5671234.57 (2 places)
FloorRound down to the nearest integer4.94
CeilRound up to the nearest integer4.15
AbsAbsolute value-4242
MultiplyMultiply by a constantFactor1001.00 (factor 0.01, for cents to dollars)
DivideDivide by a constantDivisor150015 (divisor 100)
ClampConstrain a value to a rangeMin, Max150100 (min 0, max 100)

Combine / Split

These transforms can use multiple source columns as inputs.

TransformDescriptionParametersExample
ConcatConcatenate values from multiple columnsSeparatorfirst_name + last_nameAlice Smith (separator )
CoalesceUse the first non-null value from multiple columnsmobile_phone is null, home_phone is 555-1234555-1234
TemplateBuild a string from a template with column placeholdersTemplate string{first_name} ({email})Alice (alice@test.com)
Split PartExtract the Nth segment after splittingDelimiter, IndexNew York, NYNY (delimiter , , index 2)

Conditional / Mapping

TransformDescriptionParametersExample
Value MapMap input values to output valuesMapping table, Default (optional)USNorth America, DEEurope
If Then ElseReturn one value if a condition is met, another otherwiseCondition, Then value, Else valueIf status equals activetrue, else → false
Null IfSet the value to null when it matches a specific valueMatch valueN/A → null, hellohello

Hash / Encode

TransformDescriptionParametersExample
SHA-256Hash the value with SHA-256alice@test.coma1b2c3d4...
MD5Hash the value with MD5alice@test.come4f5a6b7...
Base64 EncodeBase64-encode the valuehello worldaGVsbG8gd29ybGQ=
Base64 DecodeDecode a Base64 stringaGVsbG8gd29ybGQ=hello world
URL EncodePercent-encode the value for URLshello worldhello%20world
URL DecodeDecode a percent-encoded stringhello%20worldhello world

JSON Operations

TransformDescriptionParametersExample
JSON ExtractExtract a value from a JSON string by pathJSON path{"address":{"city":"NYC"}}NYC (path address.city)
JSON Array ElementExtract an element from a JSON array by indexIndex["a","b","c"]b (index 1)
To JSON StringSerialize the value as a JSON stringhello"hello"

Custom Code Transforms

When the built-in presets do not cover your use case, you can write a custom transform function. Custom code transforms accept the field value as input and return a transformed value.

JavaScript

JavaScript custom transforms are available when your warehouse is Snowflake or BigQuery. Write a transform(val) function that returns the new value:

function transform(val) {
  // Normalize international phone numbers
  var digits = val.replace(/[^0-9]/g, '');
  if (digits.length === 10) {
    return '+1' + digits;
  }
  return '+' + digits;
}

Python

Python custom transforms are available for all warehouse types. Write a transform(val) function:

def transform(val):
    # Capitalize each word in a name
    if val is None:
        return None
    return ' '.join(word.capitalize() for word in val.split())

Custom code runs inside your warehouse as a temporary function during the sync. It has no access to external networks or services. Keep functions simple, focused on a single transformation, and free of external dependencies.

Configuring Transforms

Using the Transform Dialog

To add a transform to a field mapping:

  1. Navigate to your sync and open the Field Mapping editor
  2. Locate the mapping row for the field you want to transform
  3. Click the Transform cell in that row (it shows “None” by default)
  4. In the transform dialog, browse categories on the left panel or use the search bar
  5. Select a transform to see its description, parameters, and a live preview
  6. Configure any required parameters on the right panel
  7. Set the Error Handling behavior (see below)
  8. Click Apply to save the transform

You can add transforms to as many mapped fields as you need. Each field mapping supports one transform.

Multi-Column Transforms

The Concat, Coalesce, and Template transforms accept multiple source columns as inputs. When you select one of these transforms, the dialog shows a column picker where you can choose additional source columns. The combined values are used as input to the transform, and the result is written to the destination field.

For example, to concatenate first_name and last_name into a Full Name destination field:

  1. Map any source column (e.g., first_name) to the Full Name destination field
  2. Click the Transform cell and select Concat
  3. In the column picker, add last_name as a second input column
  4. Set the separator to a space ( )
  5. Click Apply

Error Handling

Per-Field Error Behavior

Each transform has an error handling setting that controls what happens when the transform fails for a given row (for example, applying a numeric transform to a non-numeric value).

BehaviorDescription
Skip Row (default)The entire row is excluded from the sync when the transform fails
Set NullThe field value is set to null; the row is still synced with other fields intact
Use DefaultA fallback value you specify is used instead of the transform result
Fail SyncThe entire sync run stops immediately on the first transform error

Choose the behavior based on how critical the field is. For non-essential fields, Set Null keeps the rest of the row flowing. For fields that must be correct (like hashed email identifiers), Skip Row or Fail Sync prevents bad data from reaching the destination.

Error Rate Threshold

If the percentage of rows experiencing transform errors exceeds a configurable threshold, the sync run aborts automatically. The default threshold is 10%. You can adjust this per sync in the sync settings.

For example, if a sync processes 10,000 rows and more than 1,000 rows fail transforms, the sync stops and reports the error. This protects against misconfigured transforms silently corrupting a large portion of your data.

Testing Transforms

Before running a full sync, use the Test Transforms button in the field mapping editor to preview how your transforms affect real data. Zeotap runs the transforms against a sample of rows from your model and displays a before-and-after comparison.

This preview helps you:

  • Verify the transform produces the expected output format
  • Catch configuration mistakes (wrong date format, incorrect regex, etc.)
  • Confirm that error handling behaves as intended for edge-case values

Best Practices

  • Start with built-in presets before reaching for custom code. The built-in transforms cover the vast majority of formatting and normalization needs and are easier to maintain.
  • Use the preview feature to test transforms against sample data before running a full sync. This catches formatting issues early.
  • Set error handling based on field criticality. Use Skip Row or Fail Sync for identifier fields; use Set Null or Use Default for non-essential attributes.
  • Keep custom code simple. Write a single-purpose function with no external dependencies. Complex logic is better handled in your model SQL.
  • Use Value Map for standardization. Country codes, region names, status labels, and category values are ideal candidates for value mapping rather than custom code.
  • Chain transforms in your model when possible. If a field needs multiple transformations, consider applying some of them in your SQL model to keep the sync transform layer thin and easy to debug.

Next Steps

  • Field Mapping — Learn about mapping source columns to destination fields
  • Sync Modes — Understand upsert, insert, and mirror modes
  • Sync Runs — Monitor sync execution and inspect row-level results
  • Troubleshooting — Resolve common sync issues