Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Converting a List Into a Grouped List

You may need to convert a flat list of items into a more structured list.

For example, you may have a list of all orders that have been completed. You might want to organize that list so that you can group the orders placed by each customer.

Figure 74: Example Schema of List Conversion to a Grouped List

Procedure
1. Choose the repeating element in the function input schema that holds the grouped data. In this example, that element is `Orders`. Right-click on this element and choose Statement > Surround with For-Each-Group... from the pop-up menu. This is a shortcut to create a For-Each-Group statement with the `Orders` element as a child element and a Grouping statement to contain the element you wish to group-by.

   Adding the Grouping statement creates the `$=current-group()` element in the Scope Variables area. The Grouping statement creates the list grouped by the desired element, and the `current-group()` function allows you to access the items in the `Requests` repeating element that correspond to the group that is currently being processed.

2. Drag the repeating element from the Scope Variables area to the For-Each-Group statement.

3. Drag the element you wish to group by from the Scope Variables area to the Grouping statement in the Function panel. In this example, customerID is the grouping element.

4. Map the `current-group()` element in the Scope Variables area to the repeating element Order under the Customer element in the Function panel.

   The default choice in the mapping wizard for this mapping is to create a For-Each. Choose this option in the mapping wizard.

   This creates an item in the `Order` list for each item in the current customer ID group that is being processed. The mapping wizard asks if you wish to map items with the same name in the current group and the orders group.

5. Map the remaining element from the `current-group()` element into the desired element in the For-Each group. In this case, `quantity` would map to `Quantity` automatically, and `Item` must be mapped to `ItemName`.

6. Map the customerID element in the Requests element into the Customer 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.