- 04 Oct 2022
- 2 Minuten zu lesen
- Drucken
- DunkelHell
- pdf
Joining field values
- Aktualisiert am 04 Oct 2022
- 2 Minuten zu lesen
- Drucken
- DunkelHell
- pdf
There are a couple of ways to combine the values in multiple fields together within a formula field. This lesson will cover those methods and a few tips to enhance their functionality.
This article is part of a guided course which you can view here.
CONCATENATE()
This function joins together arguments and/or field values from any number of fields into a single text value, and follows this format: CONCATENATE(Value 1, Value 2, etc...)
For example, you can join together the values of two fields by using this formula:
CONCATENATE ({Field A}, " - " , {Field B})
Notice the addition of " - "
as a separator between the fields.
You can use concatenate to join together any number of fields and text. One of the most common uses of this function is to make the primary field in a table a unique identifier by combing several values together.
We'll use a hiring process as an example workflow for the rest of this lesson. For this type of process, it may be helpful to use the primary field to see the candidate name, and the stage of the process they're in.
This could assist someone managing the process to quickly view upcoming interviews in a calendar.
Alternative to concatenate
As an equivalent to CONCATENATE()
, using an ampersand (&
) as a separating character between values is a more simple approach to combining values.
Using the same example as the previous section, you could re-write the formula as:
{Candidate} & " - " & {Type}
When working with either function, remember that you may be combining different types of data - for example, a numeric value, a date string, and plain text - into a single field. See the result when we mix in a date field into the concatenated primary field using this formula:
Date } & ": " & {Candidate}, & " - " & {Type}
You'll need to adjust this with the DATETIME_FORMAT function to this:
DATETIME_FORMAT({Date},'L') & ": " & {Candidate} & " - " & {Type}
Note that when combining field type, it won't be possible to format that field type as a numeric value or a formatted date.
For some more reading on using a formula in the primary field, read this article.
Line breaks
When working with formulas - especially when combining several fields of information - it can often be helpful to program in line breaks and other formatting features to better display the result of a formula. By using "\n"
in a formula, you can program in line breaks as needed. For example, you may want to combine the fields shown below to produce a paragraph of text for a job description. A formula that only combines each field would result in this:
{Role / Title} & " " & {Department} & " " & {Experience Required} & " " & {Description}
For a more readable job description field, we can adjust the formula to use "\n"
to insert line breaks in the right places.
{Role} & "\n" & {Department} & "\n" & {Experience Required} & "\n \n" & {Description}
With the added line breaks, the job description becomes easier to read, and to copy and paste into other places like an online job board. To go one step further, you can even add custom text to the job description to add more context.
"Job Title: " & {Role} & "\n" & "Department: " & {Department} & "\n" & "Number of years experience required: " & {Experience Required} & "\n \n" & "Job Description: " & "\n" & {Description}
Formula FoundationsThis article is part of a guided course that helps you learn how to use Airtable formulas. |