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 NAV (Archived)

More periods in sales statistics report 112

(0) ShareShare
ReportReport
Posted on by

The standard sales statistics report when selected the date 01-01-2015 ect. have a column for 'before', '01-01-15 - 31-01-15', '01-02-15 - 28-01-15', '01-03-15 - 31-03-15', 'After'. 

I want to make it continue to show all the following 12 months. I know you can extend the periods range so it shows for a period of 3 months, but thats not what i want. 

I have tired to change the following code and inserting the fields and the layout, but i had trouble running the report because of a error.

OnPreReport()
CustFilter := Customer.GETFILTERS; FOR i := 2 TO 4 DO PeriodStartDate[i + 1] := CALCDATE(PeriodLength,PeriodStartDate[i]); PeriodStartDate[6] := 31129999D;


How should i change the code in report 112 to be able to show more date periods than the 3 from standard?

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    You need to change the code in OnPreReport trigger to define the right periodstartdate

    and

    Customer - OnAfterGetRecord() trigger - to filter the right values.  As of now, it is generating for 5 arrays. You can run the For loop as needed.

    Increase the dimensions array for all the fields.

    What is the error that you are getting currently?

    Hope this helps.

  • Community Member Profile Picture
    on at

    Hi Vishal,

    I get the error "Index out of bounds."

    What i have tried to do is changeing the code in OnPreReport.

    Changing the PeriodStartDate[6] to [14].

    OnAfterGetRecord() trigger - to filter more values. I have changed it from 1-5 to 1-13. 

    So it would look like this

    OnPreReport()
    CustFilter := Customer.GETFILTERS;
    FOR i := 2 TO 10 DO
      PeriodStartDate[i + 1] := CALCDATE(PeriodLength,PeriodStartDate[i]);
    PeriodStartDate[14] := 31129999D;
    
    OnPostReport()
    
    Customer - OnPreDataItem()
    CurrReport.CREATETOTALS(
      CustSalesLCY,CustProfitLCY,AdjmtCostLCY,AdjCustProfitLCY,
      CustInvDiscAmountLCY,CustPaymentDiscLCY,CustPaymentDiscTolLCY,CustPaymentTolLCY);
    
    Customer - OnAfterGetRecord()
    PrintCust := FALSE;
    FOR i := 2 TO 13 DO BEGIN
    ...

    Then in the dataset designer i have made more fields - periodStartDate6-12 and same with other fields.

  • Verified answer
    Community Member Profile Picture
    on at

    Have you increased the Dimensions for all the fields....

    Currently it is 5. You should increase the same, as per your need.

    4628.1.JPG

  • Community Member Profile Picture
    on at

    Thanks alot Vishal! That was just what i needed to make it work.

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 NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans