One of the new features of RTC is Charts in reports .
Today I would like to see the monthly total purchase invoices amount in charts.
Started as below..
As I need to show the Month names in Y-Axis of the Chart so I have taken Date table as my first dataitem to get the month name and year.
“Startdate” and “EndDate” are calculated to get the Months start date and end date by using “Startingdate” and “EndingDate” which are entered in request form by user.
Report - OnPreReport()
IF (StartingDate = 0D) OR (EndingDate = 0D) THEN
StartDate := CALCDATE(’<CM - 1M + 1D>’,StartingDate);
EndDate := CALCDATE(’<CM + 1D>’,EndingDate);
VendFilters := “Purch. Inv. Header”.GETFILTERS;
The “Date” table has been filtered by calculated “StartDate” and “EndDate”.
Date - OnPreDataItem()
The “Period Name” is Concatenated with the Calculated “year” and saved in “PeriodText” text variable.(will discuss the use of this variable later )
Date - OnAfterGetRecord()
PeriodText := “Period Name” + ‘-’ + FORMAT(DATE2DMY(”Period Start”,3));
In Purch. Inv. Header - OnPreDataItem() trigger
The Purchase Invoices are filtered by “Posting Date” with Months Start date and End Date
In Purch. Inv. Header - OnAfterGetRecord() trigger
The records which have Posting Date below start date and above end data are skipped.
Purch. Inv. Header - OnPreDataItem()
SETRANGE(”Posting Date”,Date.”Period Start”,Date.”Period End”);
Purch. Inv. Header - OnAfterGetRecord()
IF (”Posting Date” < StartingDate) OR
(”Posting Date” > EndingDate)
If I run the report with Starting date = 01-01-10, Ending Date = 10-01-11 and Buy-from Vendor No. = 10000 in classic client, the output is
Classic Output 1:
Now, to transform the report to RTC
Click Create Layout Suggestion under Tools..
It will create layout but the layout is not 100% so it has not created Date, Body (3) section of Classic report
So we need to create a grouping here with the variable “PeriodText” which we have calculated in Date - OnAfterGetRecord()
Here I have taken Year also because if i have entered periods in 2010 (01/01/10)and 2011(01/02/11), the grouping will be done on months like January, February of 2010 and 2011. In order to avoid that I have taken Year also in “PeriodText”.
Save the layout and report.
Transform the request form to request page by using Transformation tool.
Now run the report in RTC by adding it in any Page or Command
the Preview will look like Classic
Now we need to add Chart to Layout
From tool box drag the Chart on to the layout
Right Click and Select Properties
Set the following properties as shown in screenshots
Run the report in RTC and now we can see the monthly Purchase invoices in chart
Please let me know if you have any queries.