web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
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

  • Martin Dráb Profile Picture
    241,515 Most Valuable Professional on at

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

  • PIX Profile Picture
    570 on at

    I just have an .xpo

    It is a query obj built by AOT

  • dolee Profile Picture
    11,279 on at

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

  • PIX Profile Picture
    570 on at

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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Prashant Singh Profile Picture

Prashant Singh 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans