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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

Adding a new datasource to a form

(0) ShareShare
ReportReport
Posted on by 700

Hi community,

I have a question how to add a new data source to a standard ax form with relations to the exisiting data sources.

I have a form with a standard template that have one main datasource and three other data sources. I need to add a datasource that is connected to one of the three tables and not the main table. I miss setting a relationship like we do in a query. Where can I look up an example to do it? 

Can I add a datasource only setting properties or do I need to set relations between two tables in code?

Thank you all

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahmoud Hakim Profile Picture
    17,887 on at

    you can follow this steps

    msdn.microsoft.com/.../aa608858.aspx

  • Verified answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    For suppose if you have TableA(parentTable) and TableB(ChildTable). If both tables have relation defined at the table level, then you set properties JoinSource and LinkType on TableB. If their is no pre-defined relation/relate based on other condition, then you can make use of addLink method.In the init method of TableB include following code:

    public void init()
    {
        QueryBuildDataSource qbds;
        
        super();
        
        qbds = this.query().dataSourceTable(tableNum(TableB));
        qbds.addLink(fieldNum(TableA, CommonField), fieldNum(TableB, CommonField));
    }

    Refer below link:

    (QueryBuildDataSource.addLink Method [AX 2012])

    msdn.microsoft.com/.../querybuilddatasource.addlink.aspx

  • OrangeRocks Profile Picture
    700 on at

    Thanks for suggestions. I tried it but I need to add a datasource that will be linked to the second data source.

    EDIT[]

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans