Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Adding a new datasource to a form

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

  • OrangeRocks Profile Picture
    OrangeRocks 700 on at
    RE: Adding a new datasource to a form

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

    EDIT[]

  • Verified answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: Adding a new datasource to a form

    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

  • Suggested answer
    Mahmoud Hakim Profile Picture
    Mahmoud Hakim 17,887 on at
    RE: Adding a new datasource to a form

    you can follow this steps

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans