JOIN
The JOIN
function is used to join multiple strings together into a single string, separated by a specified separator.
The function takes two parameters: separator, which is the separator to use between the strings, and values, which are the strings to join together.
When using the JOIN function, you can specify any separator you want. The separator can be a string of any length, and can include special characters.
Syntax
string JOIN(string separator, params string[] values)
Examples
You can use fixed string values or pass in columns as the values to join. Each row will be processed separately. You can pass string array columns into the function to be converted into a string with a defined separator.
Suppose you have a list of names that you want to join together into a single string, separated by a hyphen ("-"). You can use the JOIN function to accomplish this as shown below:
JOIN("-", "Phil", "David", "William")
In this example, the separator parameter is set to "-", which specifies that the names should be separated by a hyphen.
The values parameter is a list of names, each separated by a comma.
The resulting result string will contain the joined names separated by the specified separator: Phil-David-William
.
Alternatively if you had a column that contains an array of names in each row, and you want to convert these into a string with a different separator then you can do so with JOIN
.
JOIN("-", NamesArray)
Suppose you have a list of file paths that you want to join together into a single string, separated by a pipe symbol ("|").
You need to escape any backslashes with another backslash when being used in a function i.e \\
You can use the JOIN function to accomplish this as shown below:
The column MyPaths contains the following array: C:\\Documents\\file1.txt;C:\\Documents\\file2.txt;C:\\Documents\\file3.txt
JOIN("|", MyPaths)
In this example, the separator parameter is set to "|", which specifies that the paths should be separated by a hyphen.
The values parameter is a list of paths, each separated by a semi-colon.
The resulting result string will contain the joined paths separated by the specified separator: C:\\Documents\\file1.txt|C:\\Documents\\file2.txt|C:\\Documents\\file3.txt
.
Using a customer list with the columns CustFirstname and CustSurname you can join them to get the customer full name in the format surname, first name.
The separator is a comma and a space using the html
to define the space.
In this example we will imagine the row being processed has the following values CustFirstname = John and CustSurname = Smith:
JOIN(", ", CustSurname, CustFirstname)
Which will return Smith, John.