# NIM

#### Recursion

In Intra-system relations, it is possible for a column to reference another column in the same table. This may occur:

When either situation occurs, NIM automatically offers a recursive option in any relevant Filters:

Recursive relations are particularly relevant when you're working with source system data that contains hierarchically nested user groups or departments (i.e., when you're creating Roles). However, it is possible to configure recursion for any arbitrary self-referencing data.

### Note

When working with recursive relations, it may be helpful to Reorder columns and/or Exclude columns from the Result pane.

Below are two common scenarios.

This example shows a recursive 1-N relation in the departments table of the HR500 test dataset. (The table's key is the organizational_unit column.)

The relation is recursive because the parent column has been directly related to its own table:

When this relation is invoked as a recursive relation item in a filter, the child.organizational_unit column in the Result pane returns all hierarchically nested child departments. Here, there are 83 total records:

Compare this to a non-recursive version of the same filter. In this case, the child.organizational_unit column in the Result pane returns only immediate child departments. Here, there are only 38 records:

Directionality matters in 1-N recursive relations. In the above example, the parent column can also be related to its own table (departments) on a recursive N-1 basis (as opposed to 1-N). In this case, the parent.organizational_unit column in the Result pane returns all hierarchically nested parent departments (as opposed to child departments):

In addition to 1-N recursion, in which a column is directly related to its own table, a table may be indirectly related to itself via a N-N relation.

### Tip

Unlike with 1-N recursion, there is no directionality involved in N-N recursion. It is not necessary to specify a 1-N or N-1 direction, and it is not necessary to manually relate a table to itself. Instead, you simply select recursive in the relevant filter item.

For example, in the Memberships table of this Active Directory system, the MemberDN column has been related to both the Users table and the Groups table. This has indirectly related the Groups table to itself.

When this relation is invoked as a recursive relation item in a filter, the Result pane returns all group memberships, including hierarchically nested parent groups.

(In this Active Directory system, the user laura.langdon is only a direct member of the Cardiac group. The groups are nested in the order Cardiac > Nursing > Part Time > WestlakeHospital.)

Compare this to a non-recursive version of the same filter. In this case, the Result pane returns only the one group to which laura.langdon directly belongs, Cardiac.