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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 4.0 Sorting in reports

(0) ShareShare
ReportReport
Posted on by

I was asked by someone to look into the sorting that goes on within reports. Now I have been reading manuals about this subject but have been unable to accomplish what I want.

When running a sales order report it is sorted by sales order number first. The contents (sales order lines), which appear as a part of the sales order, are put into the report in the same order they are displayed/created in the system. Is it possible to sort these contents of a sales order as well?

For instance I make a sales order with 3 items. For whatever reason I choose to create article 3 first, followed by 1 and 2. The report will then show the articles in the same order (3,1,2). What I want to do is have the report show the articles in a 1, 2, 3 order but still have the sorting order of the sales orders intact as well.

Could anyone tell me if this is possible? Should you require additional information I will be happy to supply this.

Thank you in advance.

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    299,349 Super User 2025 Season 2 on at
    RE: AX 4.0 Sorting in reports

    Hi  Sebasshhh,

    You can change the sorting of the datasource within the report itself. Standard it is indeed the creation, but you can change to have is sorted on e.g. ItemId.

    As I don't have access to an AX4 environment I cannot check further details for you.

  • Suggested answer
    Dick Wenning Profile Picture
    8,705 Moderator on at
    RE: AX 4.0 Sorting in reports

    the sales line have an field linenum, I guess that is the order by now,

    you would like to have the item id order?

  • Community Member Profile Picture
    on at
    RE: AX 4.0 Sorting in reports

    Yes, I would like to do exactly what André Arnaud de Calavon (thank you for your answer) is suggesting and sort the sales order line items by their item numbers and not the order of the creation of these sales lines as it is currently.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: AX 4.0 Sorting in reports

    I consider when you are saying Article you mean Item Id.

    So what you need to do is to sort the Item Id in Ascending order.

    You need to find out how the report Query is created and how data on the report is printed on the report.

    if you have Report DataSource with SalesTable joined with SalesLine, so many be you can set the first sort on SalesTable as SalesId and second order on SalesLine as Itemid

    If you report is developed using some logic in Fetch method and send() prints the report data  then in this case you can put you sorting logic in Fetch method.

    Please verify.

  • Verified answer
    Dick Wenning Profile Picture
    8,705 Moderator on at
    RE: AX 4.0 Sorting in reports

    I took example like salesquotation, in the query is an order by, as you can see it uses linenum, change it to itemid

  • Community Member Profile Picture
    on at
    RE: AX 4.0 Sorting in reports

    This solved it! Thank you very much Mr. Wenning!

    It turns out the report did not even sort on LineNum, I had to just manually add a new field. When I made that the ItemID it did exactly what I wanted.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans