Posted 30 November 2022, 3:11 am EST
Hi Sreejith,
As per your requirement, we understand that you are generating a Packing List Report which contains all the Orders for a particular route and you want to make a count of the number of pages each order has taken in the report.
To achieve this in a SectionReport:
- You can create a variable to store the end page number of the last order and handle the GroupFooter_Format event for the Group that separates each order.
- In the event handler, you can get the current page number using ‘this.PageNumber’ and subtract the lastOrderEndPageNumber from the current PageNumber.
- Now you have the total number of pages the current order details have taken you can store this value to where ever you require.
To achieve this in a PageReport:
- Unfortunately, as the PageReport does not contain any direct events there’s no direct way to achieve this.
However, as a workaround, you can create a similar method (in the report script) as we created for SectionReport to calculate the total number of pages for a given order and store it at your preferred location/DataBase.
- Now to invoke this method without events you can call it at the end of your DataRegion’s Group for eg. if you are using a Table control you can call your method (using “=Code.Method()”) in a TextBox within your Table’s GroupFooter.
- Within the method, you can return an empty string so that the report preview stays unaffected.
Please find attached a sample (for both RDL/Page and Section Reports) implementing a list of orders separated by the ShipCountry, the number of pages taken by each Country is then stored in a CSV file. (Please note the sample will be removed from the drive after 5 days.)
Regards,
Anand
https://drive.grapecity.com/download?file=ExternalShare/CE/Forum%20-%20Save%20page%20numbers%20to%20database/OrderGroupPagesCount.zip