Forum Discussion

Jindriska's avatar
Jindriska
Copper Contributor
Oct 08, 2023

Filter hierarchical expression group

Hello

I defined a hierarchical expression group - f.e. see below

As f.e. a primary school is still a school, I would except that filtering by "school" shows the Documents tagged with "primary school" as well. But that isn't the case.

 

How to proceed to use such hierarchical expression groups?

 

Best regards,

 

Jindriska

 

-public buildings

--school

---primary school

---highschool

--religious buildungs

--church

--synagogue

--mosque

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    Jindriska 

    In SharePoint Online, hierarchical expression groups allow you to define a hierarchy of terms for tagging and categorizing documents and items. However, filtering by a parent term in the hierarchy does not automatically include items tagged with child terms. To achieve the behavior you described, where filtering by "school" also shows documents tagged with "primary school," you can follow these steps:

    1. Modify Your Managed Metadata Column:

    Ensure that you have a Managed Metadata column in your SharePoint library that uses the hierarchical term set you described. If not, create one or modify your existing column.

    1. Update Your Document Metadata:

    Go to your document library, select the documents, and update their metadata. Make sure that you select the appropriate terms from the hierarchical term set, such as "primary school" for documents related to primary schools.

    1. Use SharePoint's Content Query Web Part (CQWP):

    SharePoint provides a Content Query Web Part (CQWP) that allows you to display content from multiple lists or libraries based on specific criteria, including metadata. You can use this web part to create custom views that display documents tagged with child terms when you filter by a parent term.

      • Edit the page where you want to display the documents.
      • Add a Content Query Web Part.
      • Configure the CQWP to query your document library and filter by the metadata column that corresponds to the hierarchical term set.
      • Customize the CQWP to display the documents as you prefer.
    1. Create Custom Views:

    Alternatively, you can create custom views in your document library that use the "Show items only when the following is true" option in the filter settings. You can specify conditions based on your metadata column to include child terms when filtering by parent terms. Here's an example:

      • Create a new view in your document library.
      • In the filter settings, set the condition to "Show items only when the following is true."
      • Use the metadata column and specify a condition like "is equal to" and choose the parent term, such as "school."
      • Save the view.

    When you filter by "school" in this custom view, it should display documents tagged with both "school" and "primary school."

    Please note that the exact steps may vary depending on your SharePoint configuration and version. Be sure to adapt these instructions to your specific SharePoint Online environment.

     

    My knowledge of the topic is limited, but since no one has answered yet, even though it has been read many times, I posted the question in various AIs and found the above suggested solution for you. The proposed solution is untested.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

    • Jindriska's avatar
      Jindriska
      Copper Contributor
      Thank you, but this did not solve my problem.
      I can't create a custom view for every "parent" term.
      Can anybody tell me, how to display the descendant term marked documents when choosing the parent term?
      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor

        Jindriska 

        I apologize for any confusion. In SharePoint Online, the default behavior for filtering by a parent term in a hierarchical term set does not automatically include documents tagged with its child terms. Each term in a hierarchical term set is treated as a separate entity by default.

         

        To display documents tagged with descendant terms when choosing a parent term, you may need to use a combination of SharePoint's out-of-the-box functionality and potentially some custom solutions. Here's an approach that involves using SharePoint's "Search" feature to achieve this:

         

        Use Managed Metadata Navigation:

         

        SharePoint Online offers a Managed Metadata Navigation feature that can help you navigate through hierarchical term sets. You can configure it to show descendant terms when you select a parent term. Here is how:

         

        Go to the site where your document library is located.

        Click on "Settings" (the gear icon) and select "Site settings."

        Under "Site Administration," click on "Term store management" (this will open the Term Store Management Tool).

        Navigate to your term set ("public buildings" in your case).

        Edit the term set.

        Under the "Custom Sort" tab, select the option "Use friendly term names."

        Save your changes.

        Modify Your Library Views:

         

        In your document library, create or modify your views to use the Managed Metadata column (the one associated with the hierarchical term set) for filtering.

        When you filter by a term, SharePoint should now display documents tagged with that term and its descendants.

        Search-based Solution (Custom):

         

        If the above method doesn't fully meet your requirements, you might consider implementing a custom solution using SharePoint Search. This would involve creating a custom search web part or search-driven pages that can display documents based on a selected term and its descendants. This would require development skills and may be more complex.

         

        Please keep in mind that SharePoint's behavior regarding term set hierarchies may vary depending on the version and configuration of SharePoint Online. If the built-in options don't provide the desired result, a custom solution might be necessary to achieve the exact functionality you're looking for.

  • We used to be able to do this in Classic SharePoint lists but was not implemented correctly in Modern lists. This bug needs to be added back in to List functionality. There should be 2 options for each Parent term in the Filter By list: Only this Term and All Child terms. The second option can simply check all the children.

    #Bug

Resources