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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

aggregate function in where select

(0) ShareShare
ReportReport
Posted on by 867

How to use aggregate functions in where select like

 while select  inventDim    

 group by inventDim.wMSLocationId , inventtable.ItemId ,                    

  where    inventDim.wMSLocationId == wmslocation.wMSLocationId          

  join inventSumExtra       where inventDim.inventDimId == inventSumExtra.inventDimId                  

 join inventTable             where inventSumExtra.ItemId == inventTable.ItemId           

 {              

info(strfmt("Sum Total Quantitiy %1",sum(inventSumExtra.TotalOrderQty)))

i am getting error on sum(inventSumExtra.TotalOrderQty).how to use sum() in this query inside the loop.Is this possible or not

*This post is locked for comments

I have the same question (0)
  • Heinz Schweda Profile Picture
    1,367 on at

    -Comment removed-

  • Verified answer
    Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    You actually don't use any aggregation function in your select statement, you try to use sum() in X++ code following the select.

    Aggregation functions must be used in field list(s) in select statement - this is the way to use in your case:

    join sum(TotalOrderQty) from inventSumExtra

    Also, don't miss Select Statement Syntax documentation.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans