cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Usmannb
Helper I
Helper I

Query hierarchically related data in Canvas App.

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.

7 REPLIES 7
DeviKrishna
Super User
Super User

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

rampprakash
Super User
Super User

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/...

 

 

Please mark as Answer if it is helpful and provide Kudos


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

ChrisHarper
Helper II
Helper II

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

Hello @DeviKrishna 

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

Hello @rampprakash 

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

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. 

ChrisHarper
Helper II
Helper II

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

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,958)