Overview
CONCAT is a string function that combines two text strings into one. It is a handy tool for merging text fields or adding additional text to existing data.
In simple terms, imagine you have different pieces of a puzzle, and you want to put them together to form a complete picture. The CONCAT function helps you assemble these pieces by joining text strings together, end-to-end, to create a single, coherent message.
Understanding the Syntax
The basic syntax for CONCAT is as follows:
Here, 'string1' and 'string2' represents the text fields or expressions you want to concatenate.
For example:
You want to create a search that would display a standardized username for each employee, consisting of the first letter of their first name followed by their last name. This ensures a consistent and easily identifiable username structure.
Formula: CONCAT(SUBSTR({firstname}, 1, 1), {lastname})
Here's how this formula works:
- SUBSTR({firstname}, 1, 1): This function extracts the leftmost character from the {firstname} field, which is the first letter of the employee's first name.
- CONCAT: It then combines this first letter with the {lastname} field to create the desired username format.
For an employee with the name "Emma Johnson", the result would be: "EJohnson", which is the desired username format.
Note: If you want to convert more than two strings, you can do so by nesting the CONCAT formula within another CONCAT formula, or use double pipes (||) instead.
Related article:
-----
If you find this information useful, let us know by reacting or commenting on this post!