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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

when to make it datasource.relations(True) OR datasource.relations(false) ?

(0) ShareShare
ReportReport
Posted on by 30

Dear All,

I wrote below query and it's working fine. I have one question when to make it datasource.relations(True) OR datasource.relations(false) ?

static void TM_AS_Query(Args _args)
{
Query query;

QueryBuildDatasource datasource;
;
query = new Query();// Add SalesTable main datasource

datasource = query.addDataSource(tableNum(SalesTable)); 
datasource = datasource.addDataSource(tableNum(SalesLine)); 
datasource.joinMode(JoinMode::InnerJoin); 
datasource.relations(false); 

datasource.addLink(fieldNum(SalesTable, SalesId), fieldNum(SalesLine, SalesId));

}

Please give me more shed on this.

Thanks!

Arpan Sen

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: when to make it datasource.relations(True) OR datasource.relations(false) ?

    It is quite obvious. If there is relations defined between the tables or their EDTs are linked to tables, AX would know what the relation is, in which case setting relations(true) would establish the connection between them for you automagically.

    If there are no relations defined or you want to change how they are linked, you can override that with relations(false), and define how to link, based on what record context.

  • @rp@n Profile Picture
    30 on at
    RE: when to make it datasource.relations(True) OR datasource.relations(false) ?

    Thanks Vilmos,

    As i understood means if i am going to create a relation between SalesTable and SalesLine with Sales Id filed ( Which is already there in SalesLine table) so, i need to make it

    QueryBuildDatasource     qbdsSalesTable, qbdsSalesLine;

    qbdsSalesTable.relations(false);  // False

    If i want to do some other relation which is not exist in SalesLine table then i need to put

    qbdsSalesTable.relations(True);  // True

    Please verify.

    Thanks!

    Arpan Sen

  • Vilmos Kintera Profile Picture
    46,149 on at
    RE: when to make it datasource.relations(True) OR datasource.relations(false) ?

    The opposite. Read what I said one more time.

  • @rp@n Profile Picture
    30 on at
    RE: when to make it datasource.relations(True) OR datasource.relations(false) ?

    Ohh.. Sorry

    Thanks Vilmos

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans