Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to Used Order By and Group By Clause in x++ Language when joins four table or more table......

(0) ShareShare
ReportReport
Posted on by 875

Anyone cal tell me how to use Order By and Group By Clause in score table on marks .Field of score table is score1,socre2,score3  like

static void CXT_Joins(Args _args)
{
CXT_Student stud;
CXT_ContacInformation contact;
CXT_Location location;
CXT_Score score;
int k=0;
;
while select stud
join score
where stud.Cxt_Stud_Id==score.Cxt_Stud_Id
join location
where stud.Cxt_Stud_Id==location.Cxt_Stud_Id
join contact
where stud.Cxt_Stud_Id==contact.Cxt_Stud_Id
info("Hi Number has inserted");
info(strFmt("Id Is=%1---Score1 Is=%2---Score2 Is=%2----Score3 Is=%3---Location Is=%4---Mobile No Is=%5",stud.Cxt_Stud_Id,score.Score1,score.Score2,score.Score3,location.Location,contact.ContactPersonPhone));

}

 

 

*This post is locked for comments

  • Verified answer
    Martin Dráb Profile Picture
    234,035 Most Valuable Professional on at
    RE: How to Used Order By and Group By Clause in x++ Language when joins four table or more table......

    Vikash, please let me quote the documentation of select statement syntax (already linked above).

    KeywordDescriptionExample
    asc An option on the order by or group by clause. The sorting is ascending. (Sort is ascending by default.) select * from custTable
        order by Name asc;
    desc An option on the order by or group by clause. The sorting is descending. select * from custTable
        order by Name desc;

    Seriously, you won't become a developer if you don't learn how to use documentation.

  • Community Member Profile Picture
    on at
    RE: How to Used Order By and Group By Clause in x++ Language when joins four table or more table......

    Hi Vikas,

    Can you please explain with example about how is your data in the tables and what results you want based on that?

  • Vikas_AX_Blogs Profile Picture
    875 on at
    RE: How to Used Order By and Group By Clause in x++ Language when joins four table or more table......

    Hi Martin Sir

    i am beginner in AX and its only for practice. I want to arrange   Score in  Ascending and descending format  so how to apply order by clause in this x++ Code.

  • Verified answer
    Martin Dráb Profile Picture
    234,035 Most Valuable Professional on at
    RE: How to Used Order By and Group By Clause in x++ Language when joins four table or more table......

    The syntax is documented, unsurprisingly, in Select Statement Syntax [AX 2012].

    You also have to realize that if you group records, you'll get values only those fields that are either grouped by or are aggregated (using aggregation functions such as sum() and maxOf()). You said that you want to group by Score1, Score2 and Score3, but you're also returning Cxt_Stud_Id, Location and ContactPersonPhone. You have to decide what to do with these fields.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans