Salesforce

How Do I Extract Specific Data from a Multi-Occurrence Compound Based on Sibling Element Data? (Magic xpi 4.13)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Extract Specific Data from a Multi-Occurrence Compound Based on Sibling Element Data? (Magic xpi 4.13)

Use a variable to extract the required filtering data from a multi-occurrence compound based on sibling element data. Then use this variable for filtering the compound using conditioned mapping.

Filter values may be concatenated in order to extract data sets from the multi-occurrence compound.

Sample Schema:

Sample XML Document:

  1. Define a variable to hold the extracted data.

  2. Drag a Data Mapper utility to the flow area.

  3. From the Toolbox's Mapper Schemas section, drag an XML type into the Source area of the Data Mapper window.

  4. In the XML Source's Properties pane, select the sample XML document.

  5. From the Toolbox's Mapper Schemas section, drag two Variable types into the Destination area of the Data Mapper window.

  6. For the first Destination, select the F.CustomerId variable. For the second Destination, select the F.Quantity variable, as shown below.

  1. In the Data Mapper screen, connect the Source XML compound element to the first Destination compound element. This is the variable’s parent.

  2. Define the filter criteria based on one or more elements in the Source. For example: Src.S1/Order/CustomerID ='100'

  3. Connect the simple elements that you want to extract to the variable in the Destination. Add an expression, if required.

  4. Connect the child Source XML compound element to the second Destination compound element (the variable’s parent).

  5. Define a filter criteria on the OrderLines map based on one or more elements in the Source. For optimization purposes, you can include a logical expression based on values extracted from the parent. For example: Src.S1/OrderOrderLines/ItemID ='210' AND F.CustomerId <> ''

  6. Connect the simple elements that you want to extract to the variables in the Destination, as shown below. Add an expression, if required.

In similar cases, but when values come from multiple Sources, it is best to divide the process into two separate Data Mappers since we cannot guarantee the sequence of events.

Reference
Attachment 
Attachment