& Operator: Concatenating Strings and Numbers
Using the "&" operator, you can concatenate multiple field values.
When concatenating strings and numbers, you must use a half-width "&" operator. You cannot use a "+" operator for this purpose.
Fields that can be concatenated with "&" operator
When using the "&" operator to concatenate fields, you can specify the following field types for concatenation.
- Text
- Number
- Calculated
- Radio button
- Drop-down
- Date1
- Time1
- Date and time1
- Lookup2
- Record created by
- Record updated by
- Record created datetime1
- Record updated datetime1
1: Use the DATE_FORMAT function to specify a formula.
2: If a field's Key Field is a "Link" field (or a "Lookup" field with a "Link" field as the Key Field), that field cannot be referenced by a formula.
Reference: DATE_FORMAT Function: Specifying the Display Format of Date and Time
Steps
This section describes how to concatenate a first name and last name that are entered separately in different fields, using an example of a company directory app.
Image of the app with configured fields:
-
Click the App Settings icon (the gear-shaped icon) at the upper right of the "View" screen.
-
On the "App Settings" screen, click Form tab.
-
Place two "Text" fields on the app form by dragging the "Text" field displayed in the list of fields on the left side of the screen and then dropping it onto the right area of the screen.
-
Open the field setting screen of each field, and change its field name and field code. As for the first field, change its field name and field code to "First Name" and "First_Name" respectively. As for the second field, change its field name and field code to "Last Name" and "Last_Name" respectively.
-
On the app form, place the "Text" field to be used for displaying the result of concatenation, and change its field name and field code to "Full Name" and "Full_Name" respectively.
-
Open the field setting screen of the "Full Name" field, select Calculate automatically, and then enter the following formula: First_Name&" "&Last_Name
A half-width '&' is used for concatenating strings. If you want the result to contain a specific string or a space, use half-width double quotation marks (""). -
Click Save on the field setting screen.
-
Click Save Form on the upper left side of the screen, and then click Update App on the upper right side of the screen.
-
On the confirmation dialog, click Update App.
You have successfully configured a field that concatenates character strings.
Enter values into the "First Name" field and the "Last Name" field, and check that the full name automatically appears in the "Full Name" field.
Tips: If there are fields with empty values
Empty fields are concatenated as empty strings.
For example, assume that a field has the following formula set: State/Province&City&Street&Building_Name&" "&Floor. In this case, even when the "Building Name" field is empty, values of other fields are concatenated.