Concatenates the output of two or more fields:

  • If the fields’ outputs are all strings, the output is a single string.
  • If any field output is an array, the output is an array if the array lengths match. The output is a string if the array lengths are unequal (using the first element of each array).
  • If a string output is present among arrays, Sensible repeats its value for every element of the output.

Parameters

The following parameters are in the computed field’s global Method parameter:

keyvaluedescription
id (required)concat
source_ids (required)array of field IDs in the current configa list of field ids to concatenate in the config
delimiterstring. default: ” “The delimiter with which to join the output of the source fields

Examples

The following example shows using the Concat method to concatenate two address fields into one.

Config

JSON
{
  "fields": [
    {
      "id": "_recipient_street_address",
      "method": {
        "id": "label",
        "position": "below"
      },
      "anchor": {
        "match": [
          {
            "text": "street address (including apt",
            "type": "startsWith"
          }
        ]
      }
    },
    {
      "id": "_recipient_city_state",
      "method": {
        "id": "label",
        "position": "below"
      },
      "anchor": {
        "match": [
          {
            "text": "city or town, state or province",
            "type": "startsWith"
          }
        ]
      }
    }
  ],
  "computed_fields": [
    {
      "id": "recipient_full_address",
      "method": {
        "id": "concat",
        "source_ids": [
          "_recipient_street_address",
          "_recipient_city_state"
        ],
        "delimiter": "\n"
      }
    }
  ]
}

Example document

The following image shows the example document used with this example config:

Example documentDownload link

Output

[

{
  "_recipient_street_address": {
    "type": "string",
    "value": "123 Anystreet"
  },
  "_recipient_city_state": {
    "type": "string",
    "value": "Anytown, AZ 12345"
  },
  "recipient_full_address": {
    "value": "123 Anystreet\nAnytown, AZ 12345",
    "type": "string"
  }
}
`