Use the For Each operator to associate the data from two feeds based on a key value that is common to both feeds.
The For Each operator takes values from each repeating element in a feed and fetches data from another feed based on a variable in the second feed. The variable in the second feed is substituted with the values from the first feed. The output contains the data from the first feed and the fetched data.
The second feed retrieves data that relates to the values in the first feed. For example, the first feed is a list of locations that include a zip code. The second feed contains information about medical facilities. For each zip code in the first feed, the URL from the second feed is run so that the medical facility information can be returned, based on the zip code.
Select a parameter from the first list. The values for the parameter in the first feed will be used to populate the second feed
The second feed must contain an explicitly declared variable or an implicit variable from a Source operator. Multiple key values and variables can be used to select from the second feed.
For each entry in this feed
Select the feed that contains the values.Name
The text to display on the For Each operator image on the canvas.Specify parameter from operator name
The variable from the second feed. The variable can include the entire URL. Additionally, the variable can include the HTTP headers and content information that was specified for the URL in the Source operator from this feed.Specify value from operator name
Load failure threshold
A value that can be computed from a value in the first feed.
You can specify one of the following:
- Specify a text value.
- Specify a function value.
- Use a variable to return the value.
- Specify a value from the Input tree.
Cancel processing of the For Each operator if the number of load failures exceeds the selected threshold. A load failure occurs when, for a given entry in the first feed, at least one source in the second feed fails to load.Tip:
If any of your sources is a feed from the catalog, you might want to change the feed type to XML. When you specify a catalog feed, the data mashup builder automatically selects the feed type that the feed was registered under. Changing the feed type changes the list of repeating elements that you can select from. Using the list of XML repeating elements can improve the output from the For Each operator. To change the feed type, open the Details window for the Source operator and use the Feed Type
field on the Advanced tab.
The For Each operator is used in the National Park Forecast
data mashup example. The example is available in the IBM® Mashup Center information center
Parent topic: Operators: imc3
Tips for better performance in the data mashup builder: imc3
Filtering by node position or by element attribute value: imc3