Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to identify/find the relation between parent and child data sources in queries

(0) ShareShare
ReportReport
Posted on by

Hi Team,

Ca you please suggest any code snippet or logic to identify the relation between the parent and child data sources for queries in AOT.

Using xpo file we unable to find the relation ship for the parent and child data sources and the relations as well.

Thanks in advance,

Phani

  • Suggested answer
    ergun sahin Profile Picture
    8,816 Moderator on at
    RE: How to identify/find the relation between parent and child data sources in queries

    If you want to determine the relationship with the code, it is actually possible. I'm not sure if the query has such a feature, but you can determine the relationships on the tables with the dictrelation.

    stackoverflow.com/.../how-can-i-get-and-show-the-fields-that-are-part-of-a-table-relation

    You need some luck. You can determine the tables by using Query and see if there is a relationship between them. However, there are situations that need to be considered.

    There may be more than one relationship between tables.

    There may be no relationship between the tables.

    There may be a different relationship defined in the query than in the table.

  • Suggested answer
    ergun sahin Profile Picture
    8,816 Moderator on at
    RE: How to identify/find the relation between parent and child data sources in queries

    You say xpo, so you're using one of the older versions.
    Apart from Cardinality (FetchMode), you first need to determine the relationship itself. If you look at the relationship tab of the child datasource, you can see through which filds the relationship is established.

    pastedimage1619423737018v2.png
    In some cases, automatic relations is used. In these cases, you can see the relationship name in child ds.

    pastedimage1619423845188v3.pngpastedimage1619423882612v4.png

    In these cases, you need to go to the table of child ds and examine the relationship with the same name in order to see between fields.

    pastedimage1619424006157v5.png

    Of course, in order to fully understand the relationship, you need to examine the concepts such as join type, cardinality, fetchmode(etc.).

  • Suggested answer
    zhifeng Profile Picture
    on at
    RE: How to identify/find the relation between parent and child data sources in queries

    Hello Phani,

    You can use Cardinality /RelatedTableCardinality  property to verify relationship. Below article has some samples: 

    docs.microsoft.com/.../cardinality-in-valid-time-state-table-relationships

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,459 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,066 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans