Joining text strings in Orbeon

Last updated on August 2, 2022

You can take text values from one or more fields and combine them to create a new value. This is known as 'concatenation'.

What this script does

This script combines the values of two or more text fields into one new value.

When to use this script

Use this script in situations where combining text provides a useful result and better citizen experience. An example is combining a person's first and last names to be able to use their full name.

The script

concat($field1, ' ', $field2, ... $fieldn)

NOTES: 

  • List each field you want to combine with a "$" followed by a Control Name, such as "$myControlName", and follow each with a comma.
  • If you want a space or other characters in between two controls, add it/them surrounded by single quotes. A space would be ' ' and a hyphen would be ' - '. Treat these extra characters like a field and add a comma before the next field.

How to use this script

You can place this script in a number of locations throughout Orbeon. Be creative.

For this example:

  • We'll assume you want to combine the value from two fields using the Calculations
  • We have fields labelled 'First Name' and 'Last Name' and named applicantFirstName and lastName repectively
  • A new field labelled 'Test of concatentation' displays the new combined value.

To combine text values:

  1. Note the Control Name of the fields you want to combine.
    (In this example they are applicantFirstName and lastName.)
  2. Create a new control to hold the new combined value.
    (In this example it's a text control labelled "Test of concatentation".)
  3. Enter the script in an appropriate place.
    (In this example, we'll use the Calculated Value section of the Formulas tab of the control's settings. See below.)
  4. Click the Apply button.

Results

NOTE: Concatenation occurs as you type and move (tab) from field to field.