Concat Function
The Concat function combines (concatenates) multiple values into a string:
concat (field 1, field 2,...)
This function is widely used to create texts by combining literal variables or values from other operations.
In Sensedia Integrations, the Concat function is available for:
-
Building instructions for technical connectors (databases, cloud providers, and ERP systems)
Example 1
Consider an integration with a step responsible for generating a sales report. The goal is to create a message with the total units sold in 2023. For example:
-
In 2023, total sales of 5000 units.
To create the message, we will use:
-
The payload of a connector available in Properties:
$.Sales.Response.Payload.totalSales
. -
Strings: represented within double quotes:
-
"In"
,"total sales of"
,"units"
-
" "
(blank space) -
","
(comma included as text).
-
-
Separators: commas separate the elements or fields to be concatenated.
-
Numbers: 2023 (not enclosed in quotes).
The Concat function would be written as follows:
concat("In"," ", 2023,",","total sales of"," ",$.Sales.Response.Payload.totalSales," ", "units.")
Example 2
Consider an integration containing an SQL database connector:
When building SQL database instructions, you must use SQL syntax. |
The SQL instruction below selects all columns from a table for the record where the value of the id
field matches the value of the id
field provided in the specified payload:
concat("SELECT * FROM clients WHERE id = ", $.clientRegistration.Response.Payload.id)
See the instruction step-by-step:
-
"SELECT * FROM clients WHERE id = ": instructs the database to:
-
Select (
SELECT
) -
all columns (
*
) -
from (
FROM
) -
the table
clients
-
and filter the query (
WHERE
) -
to return only the record where the column
id
matches a specific value indicated after the equals sign (id =
). -
$.clientRegistration.Response.Payload.id
: the value to be filtered by the instruction, extracted from theid
field in the payload of theclientRegistration
connector response.
-
Now, the value of the id
field will be replaced with a fixed value of 155
:
concat("SELECT * FROM clients WHERE id = ", 155)
This means the instruction will return all columns from the clients
table for the record where id
is 155
.
Share your suggestions with us!
Click here and then [+ Submit idea]