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 :
Small and medium business | Business Central, N...
Suggested Answer

Sort Posting Date in Reports.

(0) ShareShare
ReportReport
Posted on by 80

pastedimage1663599445063v1.pngI have used matrix reports. So, I have to print amount based on month. I have taken out month from positng date. As, Posting date is not sorted. My report is not in sorted format according to month. 

I want report like this,

pastedimage1663599551586v2.png

so, how can I send Posting order in sorted format? 

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    Please set the Sorting property with Posting Date field on ColumnGroup in the matrix Table.

    Thanks.

  • Sujan Khadka Profile Picture
    80 on at

    Hi Nitin Verma ,

               trigger OnAfterGetRecord()

               begin

                   // clear(Month);

                   Clear(Year);

                   GetNameOfMonthFromDate("Posting Date", Year, Month);

               end;

           }

       }

       procedure GetNameOfMonthFromDate(GetDate: Date; var year: Integer; var month: Text): Text[10]

       var

           ModValue: Decimal;

           NameOfMonth: Text[10];

           GetMonth: Integer;

           GetYear: Integer;

       begin

           GetMonth := Date2DMY(GetDate, 2); //Return Month value form Date

           GetYear := Date2DMY(GetDate, 3);

           Case GetMonth of

               1:

                   NameOfMonth := 'JAN';

               2:

                   NameOfMonth := 'FEB';

               3:

                   NameOfMonth := 'MAR';

               4:

                   NameOfMonth := 'APR';

               5:

                   NameOfMonth := 'MAY';

               6:

                   NameOfMonth := 'JUN';

               7:

                   NameOfMonth := 'JUL';

               8:

                   NameOfMonth := 'AUG';

               9:

                   NameOfMonth := 'SEP';

               10:

                   NameOfMonth := 'OCT';

               11:

                   NameOfMonth := 'NOV';

               12:

                   NameOfMonth := 'DEC';

           End;

           month := NameOfMonth;

           year := GetYear;

       end;

       var

           Year: Integer;

    I don't have posting date on matrix reports. I have sent in  GetNameOfMonthFromDate("Posting Date", Year, Month) and extracted months.

    Do you have any idea?

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi

    I think you dont need to use this formula, just use Posting Date as expression and write the formula their in the expression property or custom property of the text field in RDLC report to show only month, and sort column group as per posting Date.

    Please try that.

    Thanks.

  • Suggested answer
    Amit Baru Profile Picture
    3,037 on at

    Hi,

    GetMonth := Date2DMY(GetDate, 2); //Return Month value form Date

           GetYear := Date2DMY(GetDate, 3);

           Case GetMonth of

               1:

                   NameOfMonth := 'JAN';

                  NameOfMonthForSorting := '01JAN';

               2:

                   NameOfMonth := 'FEB';

                   NameOfMonthForSorting := '02FEB';

               and so on..

    Make sorting on That field and you get the desired result

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    Maybe you could also look into using a query as the dataset of your report.

    Then you can do the date grouping in the query.

  • Suggested answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    Hi, I personally also recommend using Query Object.

    More details:

    Using the Date Method to retrieve only the Day, Month, and Year Data in Queries [Group by Year-month]

    https://yzhums.com/14547/

    Hope this helps.

    Thanks.

    ZHU

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans