We have a feed containing California population by county created from a spreadsheet. The first entry is the population for the whole of California followed by population count for each of the 58 counties. We would like to compute the county population as a percentage of the California total. Since all the operators in the data mashup editor work on elements within a single repeating entry, we need to place the information in the first entry corresponding to the California overall population into each of the entry for the counties. We will used this example to show how to use the Extract operator.
To get started, we use the Source operator to read the feed created from the spreadsheet. Since we need to manipulate across entries, we will need to go to the Advanced pane, select XML as the feed Type, and pick feed as the Repeating element.
Next, we connect the Source operator to a Transform operator. We want to use a Transform operator to add an additional element to the feed containing the California population count. To make a copy of the input, select the child entry element under feed from the left hand side, right button click and select "Copy to the output tree". Next, right button click on the entry element on the left and create a new element call calPopulation. Leaving the newly created element selected, right click again on the child entry under feed on the left hand side and click "Copy to the output tree". This will copy all the entries for the different counties placed under calPopulation.
Since we only want the first entry which contains the population count for the whole state, we need to click on the copied over entry element under calPopulation and click "Specify Filter condition".
In the popup dialog, we just need to accept the default values.
Now that we have created an additional differently named element containing the California population count, we are ready to use the Extract operator. Connect an Extract operator to the Transform Operator. The Extract operator allows us to specify the child entry element under feed as the repeating element. We want to revert back to what we intensionally overridden earlier in the Source operator using the Advanced Tab. The difference here is that we can specify additional elements that can be inserted into each repeating entry. We will select the calPopulation element in the "Associated data elements" dropbox as shown in the following figure.