Skip to main content

MSDYN365BC - AL Development 09 - How to Develop New Report in AL?

Hi Readers,

I hope you all are following this series and followed and completed what we have discussed till now.

If you are new to this then Please Refer Table of Index.

Last but not least in this article we will discuss how to develop a Report in AL.

A customer would like to analyze Source of Sales based on Item Sold.


** As of now there is no provision to customize Base NAV Reports. If I am not wrong this is something on the roadmap.

Let's try to add this Report to our extension.

Add a New file Inside New Folder Report on Left-hand Panel - right click & select New File as shown below.

As per our standard page file name is - SDH_Report_50000_Sourceofsales.al


Snippet for adding a new Report, use snippet treport as shown below.



Next Step to set these Report Properties - 
  • Assign ID and Provide a name of the Report that you are adding.
  • Set UsageCategory to ReportsAndAnalysis.
  • Set ApplicationArea to All.

Let's try to understand the skeleton -

  • Dataset.
    • DataItem. -- Tables
    • Column.   -- Table Fields/Variables. 
  • Request Page.
    • Fields.
    • Action.
  • Global Variables.


    I will remove some parts of the default skeleton, that is not required for this report.
    Our Report Dataset is based on the Data Item Item Ledger Entry Table(as shown below).


    Now, let's add columns or fields Required for Report (as shown below).


    As we all (NAV Experts) know that a report is a combination of two parts -
    • Dataset.
    • Layout.
    We have completed our dataset development. Let's see how to add Layout to this report. In the Report Property Section, we need to specify the value for two properties (as shown below).

    1. DefaultLayout - RDLC & Word.
    2. RDLCLayout and/or WordLayout - File Name with Extension .rdl and .docx (Remember file name is between '')


    Now the next step that we have to do is Build the extension (Ctrl+Shift+B) to generate the Layout File as shown below.


    To Build Layout, Right Click and Select Open Externally which will open the layout file in SQL Server Report Builder as below.



    Now Design the Layout as you did till now for a NAV Report. My Design Look like below.


    Once done close the layout and it will save the layout.

    If you are ready to see how the report looks like from client, Just click F5 and Publish the Extension to Apply changes to Business Central Tenant / Database.

    Using Tell me feature search for Source of Sales and select Report, specify filter if required and run Report.


    The output will be something like below.


    Hope you learned something new today.

    We will have a summary article after this post, with that we will end this series.

    Stay Tuned for more and please add comments if any questions/suggestions.

    Regards,
    Saurav Dhyani
    www.sauravdhyani.com

    Comments

    1. I have a little issue with RDLCLayout property part. DO I create the report file first before linking it or how do i go about it?

      Thanks

      ReplyDelete
      Replies
      1. No,
        As listed in article above you just assign those parameters and then Build the extension (Ctrl+Shift+B) to generate the Layout File.

        Delete

    Post a Comment

    Popular posts from this blog

    VIEW SERVER STATE permission on SQL Server?

    Hi all, Sometime While trying to Login into a database we face an error message as shown below. --------------------------- Microsoft Dynamics NAV Classic --------------------------- You cannot start Microsoft Dynamics NAV Classic because you do not have the VIEW SERVER STATE permission on SQL Server. Contact your system administrator. --------------------------- OK    ---------------------------

    NAV 2013 R2 - Cumulative update 12 Released.

    Hi all, Please find below the details of  Cumulative Update 12 released for Microsoft Dynamics NAV 2013 R2. Title - Cumulative Update 12 for Microsoft Dynamics NAV 2013 R2 Build No. - 38053 Release Date - October, 2014 Local Version Included - AU, AT, BE, CH, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, SE, UK, RU Download Link Note: Implementing this cumulative update will require a database conversion unless you have already implemented update rollup 5.

    Error After Restore SQL Backup of NAV 2013 Database

    Hi all, we are facing a conman issue during restoring a SQL Database backup restored for NAV 2013. While Trying to run object from Object Designer we get below listed error (even the service is configured properly) - --------------------------- Microsoft Dynamics NAV Development Environment --------------------------- There are no NAV Server instances available for this database. You must ensure that a NAV Server instance is running and is configured to use the database before you perform this activity. --------------------------- OK    ---------------------------