Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

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

  • 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

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans