Parent Context
Parent context is the context inherited from a parent node. It determines what source data and intermediate results are available to descendant nodes. Some data-processing components, including core aggregation functions, join components, and variables, provide a parent-context parameter that allows you to influence the inherited context and consequently change the output.
Example
To illustrate how parent context works, we will use the mapping shown below.

The source XML file is structured in the following way:
Office | Department | Number of people |
|---|---|---|
Nanonull, Inc. | Administration | 3 |
Marketing | 2 | |
Engineering | 6 | |
IT & Technical Support | 4 | |
Nanonull Partners, Inc. | Administration | 2 |
Marketing | 1 | |
IT & Technical Support | 3 |
The mapping is processed as follows:
•The execution of the mapping starts at the root element (rows) of the target component. Since there is no incoming connection to rows, MapForce implicitly uses the source root element (Company) as the mapping context.
•The mapping counts all Person nodes in the source file and outputs a single value (21) because there is only one company in the source file.
The subsections below explain how the parent-context parameter of the count function can change the mapping context and output.
Counting people in each department
To count the number of people in each department, we have adjusted the mapping as follows:
•Connection A: Changes the parent context of the count function to the Department element. As a result, the function counts the number of people in each department.
•Connection B: Because the parent context is Department, the function is evaluated once for each department. As a result, it returns a sequence of values rather than a single value. With Connection B, MapForce creates a row element in the target for each item in the sequence.
Note: Throughout this section, we use the term sequence to refer to nodes that can have multiple occurrences. For more information about how MapForce processes sequences, see Nodes with Multiple Occurrences.

The mapping produces the following output:
<rows> |
Counting people in each office
To count the number of people in each office, we have connected the parent-context parameter of the count function to the Office element in the source. As a result, the count function is evaluated separately for each Office element.

Because there are two offices in the source file, the output includes two rows, each containing the number of people in that office and the name of the corresponding office:
<rows> |