Product: Mapping Manager
The tokenize() function can split text up into multiple pieces by defining a delimiter in order to allow for easier selection of those components.
Example XML
In this example - we are looking at a single XML item that has inserted a Tracking #s Item at the line level and has put the tracking numbers themselves within the Description, each separated by a pipe ( | ) delimiter
<Item>
<Code>Tracking #s</Code>
<Description>123456789|23456790|345678912</Description>
</Item>
Tokenize() Function
The tokenize() function has the ability to split strings into your multiple results. We simply need to point to the description we wish to split and wrap it inside a tokenize() function.
tokenize(path, delimiter)
Be sure to wrap the delimiter in either single or double quotes
Splitting the Tracking #s
You can split the above example simply by pointing to the location of the XML Element and providing it a delimiter to split across.
tokenize(Item[Code="Tracking #s"]/Description,'|')
123456789
23456790
345678912
Each bulletin represents a separate result in our xPath. Giving us a total of 3 results returned.
Selecting a Specific Tracking Number
Since in the previous example we received 3 unique results, we cannot use this within Mapping Manager as is without further selection filtering as Transaction Manager cannot use multiple XML Elements in a single xPath within its Token Mapping
We will need to select each resulting Tracking # individually by using a predicate to select the instance.
tokenize(Item[Code="Tracking #s"]/Description,'|')[1]
123456789
By defining the [1] within the xPath we're limiting our results to being returned to only the FIRST tracking number obtained. We would need to do this with each Tracking # to give it its own unique Token Mapping ability ([2],[3],[4],[...],[last()])
rev 10/17/2024