Skip to Content

Crystal Reports: third subreport has no data

Hi everyone.

Our company is using the Crystal Reports Visual Studio SDK with C-Sharp to generate an automated word document in a sans-GUI Web-API application. The .rpt file is a large document that contains two unlinked subreports, each with their own individual data source. The top-level report also has two data sources in the form of custom object collections that have been added with their own XML reference files as Database Fields. The method used to add the data sources can be found in the "SAP Crystal Reports for Visual Studio .NET SDK Developer Guide", section 1.5.4.3, as well as in the following link: http://highoncoding.com/Articles/558_How_to_Generate_Crystal_Report_Using_Custom_Object_Collection_with_ASP_NET.aspx. The XML file used for reference is usually written by hand and completely corresponds to the variables in each object.

The report works great and exports to both .doc and .pdf format, but as of late i have been trying to add a third subreport with the same kind of object collection data source and was met with nothing but problems. Originally the report would throw an invalid index exception when i tried to set the third subreport data source using the RptDoc.Subreports[index].Database.Tables[index].SetDataSource(List<>), despite the indexes being correct after testing. Currently, the report exports with no errors but the third subreport is completely blank. Has anyone had the same problem ? Any possible solutions or workarounds ?

Best Regards.

Software Used:

Visual Studio 2015 Update 3

Crystal Reports SDK version 13.0.2000.0

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 02 at 02:44 PM

    I'd like to note the solution i found for anyone searching for similar issues. The integer indexes for the Subreports[] list went out of order when the third subreport was added.

    The indexes prior to adding the third subreport were:

    Subreport 1 -> rptDoc.Subreports[0]

    Subreport 2 -> rptDoc.Subreports[1]

    When the third subreport was added it took the index of the second subreport and the second subreport took index value "2". Thus, the subreport indexing switched to:

    Subreport 1-> rptDoc.Subreports[0]

    Subreport 2-> rptDoc.Subreports[2]

    Subreport 3-> rptDoc.Subreports[1]

    The problem was solved when i flipped those indexes and set the data sources.

    It should be further added that the object collection used for Subreport 3 did not require a manual XML reference file since the was entered as a data source successfully without the menu popping up.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 01 at 02:16 PM

    13.0.2000.0 is the framework version.

    You should be on SP 24... you can get it from here:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    Don

    Add comment
    10|10000 characters needed characters exceeded

    • Hi there, thank you for your reply. I will updade to the latest available version and check back with you. Please note that i have SP18 installed in both the development environment and the deployment environment.