web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Query hierarchically r...
Power Apps
Unanswered

Query hierarchically related data in Canvas App.

(0) ShareShare
ReportReport
Posted on by 63

I have created self-referential one-to-many (1:N) relationship for CDM Task table, in the relationship definition the Hierarchical option is set to Yes.

In the documentation the process to query data as a hierarchy is explained for Model Driven App, I am wondering how can I show the same hierarchy in Canvas App?


Example:

Task 1

    Task 2

        Task 5

            Task 6

            Task 7

                Task 10

                     Task 11

    Task3

        Task 4

    Task 8

        Task9

....

 

 

NOTE: I want to go N levels deep and show all records under a selected record.

I have the same question (0)
  • Devikumari Krishna Profile Picture
    988 Super User 2024 Season 1 on at

    Hi @Usmannb ,

     

    Please try the below link.

    Relate records in Many-to-Many relationships | Microsoft Power Apps

    -------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    My Blog: Dynamics 365 Key Topics – https://d365topicsbydk.com/
    My Youtube Channel : https://www.youtube.com/channel/UCxSIryP2ah2VpEFr-Z72t1A

     

    Regards

    Devi

  • Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @Usmannb,

     

    Hope you are doing good.

     

    For 1:N Relationship and if you want to User Hierarchy, we can use Gallery Within Gallery so for a Parent Record it will Auto Show the Child Record.

     

    1. Create a Parent Gallery (Name it as ParentGallery)--> On Click of Parent Gallery Navigate to Another Form

    2. Load Child Parent(Name it as ChildLevel1Gallery) Gallery (ParentGallery.selected)

          a. Here in side a Gallery Create a Child Gallery (Gallery Inside Gallery)

          b. Set the Child Gallery (Name it as ChildLevel2Gallery) and Filter it as (ChildLevel1Gallery.Selected)

     

    Thats it 🙂

     

    You can find a Reference link here too : https://powerusers.microsoft.com/t5/Building-Power-Apps/Hierarchical-data-display-in-Powerapps/td-p/151376

     

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

  • CH-24102312-0 Profile Picture
    on at

    Hi @Usmannb 

     

    Please see my blog post below that demos how to easily descend through multiple tables to view descendants using the ForAll function

     

    Chris

    Dataverse Relations. Identifying Children, Grandchildren & Great-Grandchildren

  • Usmannb Profile Picture
    63 on at

    Hello @DeviKrishna 

    Thanks for your help but I am not looking to relate the records but to actually query the related records in hierarchy. 

  • Usmannb Profile Picture
    63 on at

    Hello @rampprakash 

    Thanks for the solution but it is not suitable to show N-levels of related records.

  • Usmannb Profile Picture
    63 on at

    Hi @ChrisHarper 

    Very well written blog but my Database structure is different then yours. I am looking for a solution to query "Hierarchical" Dataverse relationship. 

  • CH-24102312-0 Profile Picture
    on at

    Hi @Usmannb 

     

    The principle is the same whether it is seperate tables or self-joins in a single table hierarchy

     

    To present the results exactly as you require is challenging.  Embedded flexible height galleries would be an ideal approach as you could click and expand to show the hierarchy structure, but unfortunately they can only go down 2 levels

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard