Recursive Controls support in InfoPath 2003 SP1

The SP1 release of InfoPath 2003 supports recursive controls such as Repeating Recursive Section and Optional Recursive Section. Based on the schema of the solution, these controls are automatically suggested when dragging nodes from the Data Source task pane. This article talks about different types of recursion that are supported within InfoPath.

Direct Recursion:

This is the case when the node is recurring directly under itself. For example, if you are creating an organization chart, you might have a schema that has the following structure:

Employee*

EmployeeData

ID
Name
…..

Employee*

Every employee has EmployeeData associated with him and can have 0 or more employees working for him. Note that the * stands for repeating 0 or more times. If you select the top level Employee node in the Data Source task pane, InfoPath would suggest a Repeating Recursive Section in this case with the recursive instance showing up directly under its parent.

Picture of design mode for the direct recursion structure

Indirect Recursion:

This is the case when the node is recurring as a child of another node within itself. For the above organization chart, you may choose to abstract the fact that Employee is a manager or not by introducing an Optional node Manager. In this case the structure is as follows:

Employee*

EmployeeData

ID
Name
…..

Manager?

ManagerData

ID
Name
NumOfReports
…..

Employee*

In this case, when you drag top level Employee node, InfoPath will create a Repeating Recursive Section that has the recursive instance within an Optional Section that corresponds to Manager node.

Picture of design mode of the indirect recursion structure

Potential Recursion:

This is the case when the node is recurring under as one of the choices under itself. Again taking the above organization chart example, we may choose to not include EmployeeData for managers since it is covered under ManagerData. So now we could have the following structure:

Employee*

Choice

Non-Manager

EmployeeData
ID
Name
…..

Manager

ManagerData
ID
Name
NumOfReports
…..

Employee*

Now we have an employee who can either be a manager or not. In this case, when you drag top level Employee node, InfoPath will create a Repeating Recursive Section that has the recursive instance within a Choice Section.

Picture of design mode of the potential recursion structure

In summary, you have seen how InfoPath supports various types of recursion in its SP1 release. These three examples were just to illustrate the broad categories of recursion but you can go beyond these and try various other combinations based on your needs.