Skip to main content Skip to complementary content

Creating a string using parts of other strings

Create a new string by modifying other strings using the LowerCase, Concat and Substring functions.

Before you begin

You have created a map with an input and an output structure. You can use the samples provided below.

About this task

In this example, you have a JSON file with users' first and last names. You want to generate a user ID, all in lowercase, composed of the full last name and the first two letters of the first name. You can use the following JSON sample as input:
{
	"users": [
		{
			"lastName": "Doe",
			"firstName": "John"
		},
		{
			"lastName": "Smith",
			"firstName": "Jane"
		},
		{
			"lastName": "Scott",
			"firstName": "Michael"
		}
	]
}
You can use the following JSON sample to create your output structure:
{
	"users": [
		{
			"lastName": "",
			"firstName": "",
			"id": ""
		}
	]
}

Procedure

  1. Drag and drop the input users element on the corresponding output element to map lastName and firstName.
  2. Drag and drop a LowerCase function on the output id element.
  3. Add a Concat function on the InputValue attribute of the LowerCase function.
  4. Drag and drop the input lastName element on the Concat function.
  5. Add a Substring function on the Concat function, under lastName.
  6. Drag and drop the input firstName element on the Input Value attribute of the Substring function.
  7. Double-click the Substring function to configure its properties:
    1. Enter 1 in the Start field to indicate that the substring should start with the first character of the firstName element.
    2. Enter 2 in the Length field to indicate that the substring should have a length of two characters.
  8. Click OK.

Results

Your map is configured and should look like this:
You can use the Test Run feature to see the result. In this example, the following output is returned:
{
    "users": [
        {
            "lastName": "Doe",
            "firstName": "John",
            "id": "doejo"
        },
        {
            "lastName": "Smith",
            "firstName": "Jane",
            "id": "smithja"
        },
        {
            "lastName": "Scott",
            "firstName": "Michael",
            "id": "scottmi"
        }
    ]
}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!