Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

Recursive Controls support in InfoPath 2003 SP1

Recursive Controls support in InfoPath 2003 SP1

  • Comments 3

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.

Leave a Comment
  • Please add 6 and 8 and type the answer here:
  • Post
  • This feature is quite welcome and works relatively well. However, during data entry the default number of recursions is always always too high and makes keyboard-centric data entry difficult.

    So when a new recursive element is added during data entry, InfoPath generates two or more child elements by "default." I usually end up removing these child elements with a series of time-consuming mouse clicks becuase there is no keyboard shortcut documented for removing ANY element on an InfoPath form.
  • Re: two or more child elements by "default"

    Try going to Tools | Default Values... and unchecking the nodes you don't want present. By default, this affects both:

    - the "template.xml": the default XML a new form starts with; and

    - the "fragment": the XML added when an item is inserted

    Generally, InfoPath keeps the template structure and fragment in sync, so if you modify the template that changes what the fragment looks like. If you ever need to make the fragment different than the template structure, go into "Edit Default Values..." within the control properties.

    Re: keyboard

    If you have a Section (Optional, Repeating, Choice) selected and want to delete it, just hit the Delete key. If instead just have focus inside a child control (e.g. a Text Box), hit Shift+Right Arrow to extend selection, which will select the Section, then Delete.
  • Re: Tools > Default Values... Command in Design Mode

    This feature is awesome! I appreciate you letting me know about it! Productivity has increased!
Page 1 of 1 (3 items)