Substring transform function

Introduction

The substring transform function extracts part of a string value based on a given start point (i.e. where to begin counting) and a given length (i.e. how many characters to return).

A start value can be a positive or negative number, where:

  • Positive numbers count from the start (left to right)

  • Negative numbers count from the end (right to left)

circle-info

Counting starts at 0.

To better understand how this works, consider the example payload below:

{"greeting":"good morning"}

The positive and negative indices for this string value are shown below:

            G   o   o   d   _   m   o   r   n   i   n   g
Index +     0   1   2   3   4   5   6   7   8   9  10  11 (from start)   
Index -   -12 -11 -10 -09 -08 -07 -06 -05 -04 -03 -02 -01 (from end)                                 

Now we can easily work through some sample settings:

Start
Length
Output

0

4

good

1

3

ood

5

7

morning

-7

7

morning

-12

4

good

-15

4

good

circle-info

Notice that the last sample setting has a length counting back further than the actual length of our sample string value. In this case, counting goes back as far as possible.

Adding a substring transform

Step 1 In your process flow, access settings for your map shape:

Step 2 Select the add transform icon for the required mapping rule - for example:

Step 3 Click the add transform button:

Step 4 Click in the name field to access a list of all available transform functions, then select substring from the string category:

Step 5 In the start field, enter the position at which counting should begin - for example:

circle-info

Remember:

  • Counting starts at zero

  • A positive number counts from left to right

  • A negative number counts from right to left

Step 6 In the length field, enter the number of characters to return - for example:

Step 7 Click the add field button:

Step 8 Click in source fields and select the source field to be used for this transform:

Step 9 Accept your changes (twice) and then save the transform. You'll notice that the transform icon is updated to indicate that a transform function is present for the mapping row - for example:

Last updated

Was this helpful?