Ivandt logo

Combine Field

Computed read-only field that combines values from other fields

The combine field is a computed, read-only field that automatically generates its value by combining values from other fields using a template.

Basic Usage

{
  type: 'combine',
  label: 'Full Name',
  key: 'fullName',
  order: 2,
  combine: {
    template: '{firstName} {lastName}'
  }
}

Properties

Required

  • combine - Configuration object with:
    • template (string) - Template string with {fieldKey} placeholders

Plus all common field properties, except alternativeMatches (not applicable for computed fields).

Automatic Behavior

The SDK automatically:

  • Marks the field as readOnly
  • Adds a CombineColumns transformer
  • Hides the field from the mapping step (since it's computed, not imported)

Template Syntax

Use {fieldKey} placeholders in the template. They're replaced with actual values from the corresponding fields:

{
  template: '{firstName} {lastName}'
}

If firstName is "John" and lastName is "Doe", the result is "John Doe".

Use Cases

  • Full name from first + last name
  • Full address from street, city, state, zip
  • Display names, labels
  • Computed identifiers
  • Any field derived from other fields

Example

import type { IvtSchema } from '@ivandt/importer';

const schema: IvtSchema = {
  title: 'Contact Import',
  publicKey: 'pk_live_xxx',
  sessionToken: 'session_xxx',
  fields: [
    {
      type: 'text',
      label: 'First Name',
      key: 'firstName',
      order: 0
    },
    {
      type: 'text',
      label: 'Last Name',
      key: 'lastName',
      order: 1
    },
    {
      type: 'combine',
      label: 'Full Name',
      key: 'fullName',
      order: 2,
      combine: {
        template: '{firstName} {lastName}'
      }
    },
    {
      type: 'text',
      label: 'Street',
      key: 'street',
      order: 3
    },
    {
      type: 'text',
      label: 'City',
      key: 'city',
      order: 4
    },
    {
      type: 'text',
      label: 'State',
      key: 'state',
      order: 5
    },
    {
      type: 'text',
      label: 'Zip',
      key: 'zip',
      order: 6
    },
    {
      type: 'combine',
      label: 'Full Address',
      key: 'fullAddress',
      order: 7,
      combine: {
        template: '{street}, {city}, {state} {zip}'
      }
    }
  ]
};

With Transformers

You can still apply transformers to combine fields:

{
  type: 'combine',
  label: 'Display Name',
  key: 'displayName',
  order: 2,
  combine: {
    template: '{firstName} {lastName}'
  },
  transformers: [
    { action: 'toUpperCase' }
  ]
}

Notes

  • Combine fields are always read-only
  • They don't appear in the mapping step
  • They update automatically when dependent fields change
  • Empty placeholders are replaced with empty strings
  • You can reference any field in the schema by its key