Skip to main content



No record found.

Microsoft Dynamics AX forum

AX 2009: form with multi data sources

Posted on by 5

Hi everybody,

It's the first time that I post in this forum.
I can't resolve a basic issue with three datasource in a form.

DS1  Inventtrans is joined with DS2  WMSJournalTrans (with innerjoin mode by properties and using native links between tables)

DS2 WMSJournalTrans is joined with DS3 WMSJournalTable (with innerjoin mode by properties and using native links between tables)

How can i add by code (and where can I add this code?) a relation between DS1 InventTrans and DS3 WMSJournalTable to obtain this restriction WMSJournalTable.packingSlip = InventTrans.packingSlipID ?

Actually I wrote In init() method of DS3 WMSJournalTable:

QBDSWMSJournalTable     =   this.query().dataSourceName("WMSJournalTable");
QBR_WMSJournalTable     =   sysquery::findOrCreateRange(QBDSWMSJournalTable, fieldnum(WMSJournalTable, packingSlip));

The result Query lokks like:

SELECT FIRSTFAST * FROM InventTrans WHERE ((TransType = 3)) AND InventTable.ItemId=InventTrans.ItemId

JOIN FIRSTFAST * FROM WMSJournalTrans WHERE InventTrans.InventTransId = WMSJournalTrans.inventTransId

JOIN FIRSTFAST * FROM WMSJournalTable WHERE WMSJournalTrans.journalId = WMSJournalTable.journalId AND ((packingSlip = N'inventtrans.packingSlipID'))

(in blue) It seem to be correct but there's no result in grid.
This query give me results in SQLServer.

Thanks a lot for support.


  • RE: AX 2009: form with multi data sources

    Hi Sergei and thanks for your support.

    It works.

    I've already used addlink() with no success because I wasn't writing the third parameter (DataSource Parent).

    With this third parameter (optional) : it works!

    Many thanks




  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,083 on at
    RE: AX 2009: form with multi data sources

    Hi Microsoft Dynamics AX 2009,

    The code provided by you adds range (filter) by the field with value N'inventtrans.packingSlipID'. If you want to add the link, you need to use the method addLink on QueryBuildDataSource object.

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 . . .


André Arnaud de Calavon Profile Picture

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

Martin Dráb Profile Picture

Martin Dráb 225,862 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans