Product: Mapping Manager
Node Selection
Utilizing Square Brackets [ ] can help filter selections by limiting selections based on a value, instance, or attribute when combined with your standard pathing
Usage | xPath | Info |
Instance Selection | //Item[1] | |
Select Quantity based on Item Code | //Item[ItemNo="Shipping"]/Quantity |
|
Select An Item based on Attribute of type 'allowance' | //Item[@type='allowance'] |
|
|
|
|
|
|
|
Strings
Usage | xPath |
Combine Customer ID and Ship To Code | concat(//CustomerID,//Addresses/ShipToCode) |
Split "Locations" based on Comma-Delimiter | tokenize(//Locations,",") |
Select First Entry of Locations | tokenize(//Locations,",")[1] |
Select Third Entry of Locations | tokenize(//Locations,",")[3] |
Math
Math Operators
Usage | Operator |
Add | + |
Subtract | - |
Multiply | * |
Divide | div |
Multiply
Usage | xPath |
Multiply Quantity and Unit Price | (Quantity*UnitPrice) |
Multiply Quantity and Unit Price for First Item Only | //Item[1]/(Quantity*UnitPrice) |
count()
Count returns the number of nodes within the XML that match the selection (not their values)
Usage | xPath |
Count # of Items | count(//Item) |
Count how many siblings are before the current loop | count(preceding-sibling::*) |
Count how many siblings of type Pack are before the current loop | count(preceding-sibling::Pack) |
sum()
The sum() function will add all values together
Usage | xPath |
Sum All Unit Prices | sum(//Item/UnitPrice) |
Sum Total Gross Weight | sum(//Item/(Quantity*GrossWeight)) |
Sum (with Validation of value) | sum(//qty/text()) |
Sum All Unit Prices
xPath
sum(//Item/UnitPrice)
<Items>
<Item>
<ItemNo>MNT-DW 12PK</ItemNo>
<Description>Mountain Dew - 12 Pack</Description>
<Quantity>1</Quantity>
<UnitPrice>4.99</UnitPrice>
<UnitOfMeasure>Case</UnitOfMeasure>
</Item>
<Item>
<ItemNo>DORT-NACH</ItemNo>
<Description>Doritos - Nacho</Description>
<Quantity>2</Quantity>
<UnitPrice>3.49</UnitPrice>
<UnitOfMeasure>Each</UnitOfMeasure>
</Item>
</Items>
Result: Double='8.48'
Advance Pathing (Axis)
Function | Purpose |
preceding-siblings::nodeName | Selects all sibling nodes that appear before it |
following-sibling::nodeName | Selects all sibling nodes that appear after it |
If-Then-Else
Example | Purpose | Info |
if(//entityInternalId[.='6312']) then('6312-1') else (//entityInternalId) | Check for a specific ID and append value to it, otherwise return given value | |
|
|
|