Conditional repeating a report in a report, with a cover letter

Posted by: awerber on 4 August 2017, 3:08 pm EST

  • Posted 4 August 2017, 3:08 pm EST

    We have this existing report that is usually a 2 page letter. We usually print several of these reports at a time. In other words, the typical recordset used to get the data will have more than one record in the recodset.


    Now, we want to modify this for some of the generated reports depending on a value in the record. For one value, we just want to create the usual 2 page report. For other records, with the other value we want to do the following:


    Cover letter - Report - Report


    In other words, we want to start with a cover letter and repeat the exact same report with the same data.


    I can easily set up the cover letter part followed by the report by setting up the cover letter as a subreport in the report. But I'm not sure how to run 2 instances of the same report in a row.


    After further work on this, it seems like I want a main report with 3 sections. The 3 sections would have one subreport. One of these subreports would hold the cover letter report, the subreports in the other two sections would reference the two page report. If this is the optimal solution, I need to know how to add two sections to a report. I started up a new report, and removed the default page header and footer sections. But I cannot seem to add a new section using the designer. It looks like I can add detail sections programmatically, but I don't know how to do this. So, I'd like to know how to add two more detail sections with the designer. I guess.


    Also, since we're getting the .NET version soon, I'd also like to know how to do the same thing, just in case we ever need to do such a thing with that product.

  • Replied 4 August 2017, 3:08 pm EST

    Hello ,


    Actually, you can create each report independently and then merge them in a single report.


    Here is a sample of code:


    Private Sub ActiveReport_ReportEnd()
       Dim rpt As New arTOC
       Dim iPg As Integer
       Dim pg As Canvas
       'Runs the arTOC report to generate the TOC
       Set rpt.PrintTOC = TOC
       rpt.Run
       ' Insert all the arTOC pages into the end of
       ' this report
       iPg = Me.Pages.Count
       For Each pg In rpt.Pages
          Pages.Insert iPg, pg
          iPg = iPg + 1
       Next
       ' Commit all changes to the pages collection
       Pages.Commit
       Unload rpt
       Set rpt = Nothing
    End Sub


    http://www.datadynamics.com/forums/1/ShowPost.aspx


    Thanks,


    Sergey Romanov.


     

Need extra support?

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

Learn More

Forum Channels