Filtering Related Items by various field types

The Related Items control can be filtered by almost any field of the parent form. Find most popular cases below:

ID (parent) – Lookup (child)

  1. Navigate to the source list and add ID as an additional column of the lookup column pointing to the parent list:
    List settings → Columns → Pick the lookup column → Add a column to show each of these additional fields → Pick the ID.
  2. In Forms Designer, pick the source list in the Data Source editor and set filtering option to ‘Filter by form field’.
  3. Set Form Field to ID and List Field to additional column that you added on step 1.

Filtering SharePoint list by lookup ID

Text (parent) – Lookup (child)

  1. In Forms Designer, pick the source list in the Data Source editor and set filtering option to ‘Filter by form field’.
  2. Set Form Field to the Text field that is used as a display field of the lookup column of the source list and List Field to the lookup field.

Filtering SharePoint list by lookup text

Lookup (parent) – Lookup (child)

  1. In Forms Designer, pick the source list in the Data Source editor and set filtering option to ‘Filter by form field’.
  2. Set Form Field to a Lookup field of the current list and List Field – to a Lookup column of the related list.
  3. Put an HTML-control onto the form, switch CDATA property to False and insert the following content:
    <xsl:variable name="FieldValue" select="substring-before(substring-after(@Lookup,'&gt;'),'&lt;')"/>
    <xsl:comment>
      <xsl:value-of select="ddwrt:GenFireConnection(concat('*', '@Lookup=', ddwrt:ConnEncode(string($FieldValue))), '')" />
    </xsl:comment>
    

    Replace both occurrences of ‘Lookup’ with the internal name of the lookup field of the current list.

Filtering SharePoint list by lookup

User (parent) – User (child)

  1. In Forms Designer, pick the source list in the Data Source editor and set filtering option to ‘Filter by form field’.
  2. Set Form Field to a User field of the current list and List Field – to a Lookup column of the related list.
  3. Put an HTML-control onto the form, switch CDATA property to False and insert the following content:
    <xsl:variable name="FieldValue" select="substring-after(substring-before(substring-after(@User,'userdisp.aspx?ID='),'&lt;'),'&gt;')"/>
    <xsl:comment>
      <xsl:value-of select="ddwrt:GenFireConnection(concat('*', '@User=', ddwrt:ConnEncode(string($FieldValue))), '')" />
    </xsl:comment>
    

    Replace both occurrences of ‘User’ with the internal name of the user field of the current list.

Filtering SharePoint list by User field

Additional materials

Find more info in our blog:
How to filter related items by almost any field
Dynamic filtering of the Related Items with JavaScript