Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Merging Two Corresponding Lists

You may need to merge two lists that have corresponding items into one repeating element.

For example, you may have a list of student IDs and a list of grades, each grade corresponds to the student ID in the same position in the student ID list.

Figure 76: Example Schema of Merging of Two List

Procedure
1. Map the first repeating element from the Scope Variables area into the Grades repeating element in the Function panel. In this example, the `$RetrieveStudentIDs/Students/Record` is the first repeating element.

   This brings up the mapping wizard with the default choice of creating a For-Each statement. Click Finish in the Mapping Wizard dialog to create the For-Each statement.

2. Drag the second repeating element into the For-Each statement.

3. The Mapping Wizard dialog appears asking you to choose an option. Choose the Merge parallel repeating structure option and click Next.

4. Merging two parallel repeating structures requires two variables. The mapping wizard prompts you to name these two variables. One variable is to hold the position number of the current item being processed, and the other variable is to hold the item in the second list that corresponds to the position of the item in the first list. Create the variables with the default names supplied by the mapping wizard, or choose your own names for these variables. Click Finish to proceed.

   The two variables appear in the Scope Variables area once you have completed this step. The two variables also appear in the Function panel with the correct XPath statement to produce the desired result.

   The `$=[index=]` element contains the XPath formula `position()` to set the element with the current position number of the list item being processed. The `$=[item=]` element contains a statement to retrieve the item in the second repeating element that corresponds to the position of the item in the first list that is currently being processed.

5. Map the `ID` element to the `StudentID` element in the function arguments.

6. Map the `$=item/Grade` element to the `Grade` element in the Function panel.

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.