cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
4th8
Frequent Visitor

Relationship chaining

I am looking to show information on a form or view about a tables related tables. For example, a car entity has a one to many relationship with manufacture entity who in turn has a one to many relationship with a parent company entity. I would like on the view for the car entity to show information about the parent company. Anyone know of a way to drill up the chain of relationships?

 

In pseudocode it would be something like: Car.Manufacturer.ParentCompany.Name 

7 REPLIES 7
cchannon
Super User
Super User

I would probably chain together Form Component Controls or Quick View Forms.

 

A Form Component Control lets you almost IFrame in a form from a related entity, which is part of what you're looking for. It does not do multiple hops on its own though, so you would have to chain a couple together. The idea is from Entity 1 you make a FCC form or a Quick View form and you display it on a special FCC for for entity 2, then on entity 3 you have a FCC that shows the special form of entity 2, which is really just a FCC/QV of entity 1.

 

cchannon_0-1632484759828.png

 

 

 

dpoggemann
Super User
Super User

Hi @4th8,

 

I have had this type of situation a number of times in projects and what I have really always done to simplify my world, provide the best ability to add related columns to views etc on the "Car" entity etc. is to actually add the Manufacturer and Parent Company to my Car entity as well.  So I would have two lookup columns on the Car entity for the direct parent and the grandparent. 

 

If your entity's parent can change then you have to watch for this or put code specifically (in workflow for example) that when the user changes the parent that it will automatically look at the parent's parent and change that grandparent value on the Car record.

 

Overall keeping these multiple levels of relationships (although not the best normalization) has allowed the best flexibility in my applications and I have never regretted doing this on a single project.  I have some where it is 4+ levels deep.

 

I then utilize Quick Views on the forms to show the information from the related entities and on the Views I can utilize the related entities and add the columns as needed.

 

Hope this helps.  Please accept if answers your question or Like if helps in any way.  

 

Thanks,


Drew

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
4th8
Frequent Visitor

@dpoggemann This sounds like a good solution. Could you please explain a bit further as to how i would set the grandparent fields based on the value of the parent fields?

dpoggemann
Super User
Super User

The normal way I do this is utilizing Attribute Mapping from the relationship definition.  You can open up the relationship definition and you will see "Mappings" where you can define the mappings from the parent to the child entity.

attribute_mapping.jpg

 

This will work when you create the Child when in the Parent entity under a specific Subgrid or the Related Tab. 

 

Hope this helps.  Please accept if answers your question or Like if helps in any way.


Thanks,


Drew

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

@dpoggemann is right: attribute mapping is the standard way to do this, and by far the easiest. But, it does have some limitations. Namely, if you create the child then attach it to the parent, or create the child from a context other than the parent record, the mappings will not carry through.

These are not the standard pathway, so normally field mappings will be the right solution. But if you need to support indirect parenting of the child record like this, then you can also just configure a PowerAutomate Flow to look up the grandparent value and populate it.

4th8
Frequent Visitor

@dpoggemann How do i find that relationship definition screen? 

dpoggemann
Super User
Super User

Hi @4th8 ,

 

1.  Go to your Solution

2.  Choose from menu "Switch to Classic"

dpoggemann_1-1632942254157.png

 

3.  Choose your N:1 relationships on the Child Table

dpoggemann_2-1632942505308.png

4.  Double click on this relationship to show detailed page for definition of the relationship (you will see Mappings on the left side of the screen)

dpoggemann_3-1632942571016.png

5.  Click on the "New" to define mapping from the Parent to the child

dpoggemann_4-1632942649210.png

 

Hope this helps.  Please accept if answers your question or Like if helps in any way.

 

Thanks,

Drew

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PWREduCon768x460.png

Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Users online (3,668)