& Operator: Concatenating Strings and Numbers
Using the "&" operator, you can concatenate multiple field values.
When concatenating strings and numbers, you must use a "&" 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 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 dialog 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 dialog of the "Full Name" field, select Calculate automatically, and then enter the following formula: First_Name&" "&Last_Name
A "&" is used for concatenating strings. If you want the result to contain a specific character string or a space, use quotation marks (""). -
Click Save.
-
Click Save form on the upper left side of the screen.
-
Click Update app on the upper right side of the screen.
-
On the Update app dialog, click Update app.
-
Enter values in the "First Name" and "Last Name" fields on the New record screen, 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.