& 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 the Key Field is a "Link" field or a "Lookup" field (whose Key Field is a "Link" 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 app's "View" screen), then select the Form tab.
-
Place two "Text" fields on the app form. To do so, drag the "Text" field from the list of fields on the left side of the screen and drop it in the area on the right side of the screen.
-
Open the field settings and change the field name and field code for each field. For the first field, change the field name to "First Name" and the field code "First_Name". For the second field, change the field name to "Last Name" and the field code to "Last_Name".
-
On the app form, place a "Text" field to be used for displaying the result of concatenation, then change its field name to "Full Name" and its field code "Full_Name".
-
Open the field settings 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 character 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 in the "First Name" and "Last Name" fields, then 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, the values of the other fields are concatenated.