Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Unanswered

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

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:



  • 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 228,089 Super User 2024 Season 2 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).

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans