Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

AX 2009: form with multi data sources

(0) ShareShare
ReportReport
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));
QBR_WMSJournalTable.value(strfmt('%1.packingSlipID', inventTrans_ds.name()));

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.

Regards

  • 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

    .

    BR

    Christophe

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 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.

    docs.microsoft.com/.../querybuilddatasource-class

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,253 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans