Save page numbers to database

Posted by: sreejith.sreedharan on 28 November 2022, 4:25 pm EST

    • Post Options:
    • Link

    Posted 28 November 2022, 4:25 pm EST

    Hello,

    I am running AR16 on VS 2022 (.NET framework 4.8). I have created a report that is essentially our packing list. The packing list prints all the orders for a particular route, and each order is printed individually. I used your built-in functions to print the current and total page numbers for each order, and that works smoothly. However, i now have the task to save how many pages were printed per order to a database, so they can run a report off of that to ensure accuracy. Is there any way to capture this information as the report is getting generated?

    Thank you

    Sreejith

  • 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

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels