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

X++ select group by date

(0) ShareShare
ReportReport
Posted on by

Hi,

It seems a stupid question but I tried multiple combination and failed.

In table A, I have thousands of records and I want to get all the different dates in this record.

In SQL, I know I can do it simply by

select date from TableA group by date

But now for X++ in AX

I tried

while select   A group by A.Date
{

}

without success. In MS doc, the examples are for number or counting no dates. I don't quite understand how to achieve my requirement.  Any help is grateful! Thanks!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at

    https://msdn.microsoft.com/en-us/library/aa656402.aspx

    group by

    Instructs the database to group selected records by fields.

    CustTable custTable;

    ;

    while select sum(CreditMax) from custTable

        group by CustGroup

    {

        print custTable.CustGroup, " ",custTable.CreditMax;

    }

    You could do a count(RecId) to see how many records you have for the specific date instead of the sum() aggregate function in the example, and use the date for your grouping.

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    It would help if you actually explained your problem. Saying "without success" doesn't tell us too much.

  • Community Member Profile Picture
    on at

    Hi Martin, my result is no result in return in my selection

  • Mea_ Profile Picture
    60,284 on at

    Do you have any records in that company ?

  • Community Member Profile Picture
    on at

    Yes, you are right. I made a mistake.

  • Community Member Profile Picture
    on at

    Thanks, the problem is solved.

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