Salesforce

How Do I Iterate on a Series of Values? (Magic xpi 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Iterate on a Series of Values? (Magic xpi 3.x)

There are three different ways to iterate on a series of values in Magic xpi:

  • Auto repeat

  • GoTo

  • Call Flow

Auto Repeat

You define this option in the Flow Properties dialog box. Auto repeat determines whether the Server should invoke the flow again when the last flow component in the flow is completed. You can use this functionality to create a loop effect.

GoTo

In your flow, you can indicate which component should be executed when the execution of one branch is complete. You can do this by using Magic xpi’s GoTo command. To use the GoTo command:

  1. Select the component that you want to go from.

  2. Right-click and select GoTo.

  3. Select the component you want to go to.

  4. Magic xpi makes the connection.

When you complete these steps, Magic xpi displays a dashed line pointing to the component to be executed next.

Note:

You can only use the GoTo command:

  • With components that share a common parent component.

  • To point either to linear components or to a component in a linear branch.

Call Flow

This is an option available in the Data Mapper Service as part of a Destination definition. You can use Call Flow to create a number of loops according to the number of times the flow is called by the data from the data Source.

Example

This example assumes that you receive orders from customers in XML format. The XML file contains all the items and the quantities required. Each order may contain a different number of items and you want to set up a mechanism to check the overall stock availability for the orders.

  1. Create two new flows: FlowA and FlowB.

  2. Add two new flow variables to FlowB: F_Items and F_Amount.

  3. Drag a Data Mapper Service to FlowA.

  4. Click Configuration to open the Source/Destination Management dialog box.

  5. Create an XML Source. Click Properties to open the Source properties dialog box and configure your XML Source.

  6. In the Destination area, create a new Call Flow Destination.

  7. Click Properties to open the Destination properties dialog box and select FlowB. Click OK to return to the Source/Destination Management dialog box.

  8. Click Map to open the Data Mapper screen.

  9. Map the values from the XML file to the two flow variables.

  10. Map the Source compound element to the flow name in the Destination column.

This results in the second flow being invoked a number of times, corresponding to the number of items contained in the order.

Reference
Attachment 
Attachment