Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

[Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "T2.QTY" could not be bound

(0) ShareShare
ReportReport
Posted on by 570

Hello all,

I've a runbasebatch class which use a simple query object  like this:

SELECT COUNT(T1.RECID),SUM(T2.QTY),SUM(T2.COSTAMOUNTPOSTED),SUM(T2.COSTAMOUNTADJUSTMENT),COUNT(T2.RECID) FROM (SELECT TOP (2147483647) 1 AS RecId FROM INVENTTABLE T1 CROSS JOIN INVENTTRANS T2 CROSS JOIN INVENTTRANSORIGIN T3 WHERE ((T1.PARTITION=?) AND (T1.DATAAREAID=?)) AND (((T2.PARTITION=?) AND (T2.DATAAREAID=?)) AND (((T2.STATUSISSUE=?) OR (T2.STATUSISSUE=?)) AND (T2.ITEMID=T1.ITEMID))) AND (((T3.PARTITION=?) AND (T3.DATAAREAID=?)) AND ((T3.REFERENCECATEGORY=?) AND (T2.INVENTTRANSORIGIN=T3.RECID))) GROUP BY T1.ITEMID ORDER BY T1.ITEMID ) AS T1

The query is an inner join, group by itemId on Inventtable, inventtrans and inventransorigin, fetch mode 1:1

I get the SQL error trying to add new value range to the query in the run() method:

 qbr = SysQuery::findOrCreateRange(qr.query().dataSourceTable(tableNum(inventTrans)), fieldNum(inventTrans, DateFinancial));
 qbr.value(SysQuery::range(fromDate, toDate));  <--- 

If I don't add the qbr.value  instruction all works fine, but unfortunately I have to override the  Datefinancial with a new range

Any idea?

KR

PS: This is the query definition:



*This post is locked for comments

  • PIX Profile Picture
    PIX 570 on at
    RE: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "T2.QTY" could not be bound

    Hello,

    really strange but the reason is due to the following instr:

    progressTotal = QueryRun::getQueryRowCount(qr.query(), intMax());

    replacing that with SysQuery::countloops()

    all works fine!!!

    I don't know why but works....

  • dolee Profile Picture
    dolee 11,279 on at
    RE: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "T2.QTY" could not be bound

    Please send the xpo to dlee@pbc.co.jp.

  • PIX Profile Picture
    PIX 570 on at
    RE: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "T2.QTY" could not be bound

    I just have an .xpo

    It is a query obj built by AOT

  • Martin Dráb Profile Picture
    Martin Dráb 230,605 Most Valuable Professional on at
    RE: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "T2.QTY" could not be bound

    Don't you have X++ definition of the query (QueryBuildDataSource etc.)? Now if somebody wants to try it, he musts rework the whole query from SQL to X++ (and probably won't bother).

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans