C# .NET - No contents display in SubReport in Crystal Report..

Asked By Eswaran Radhakrishnan on 23-Dec-08 01:36 AM

Hi all,

I need to insert a subreport in crystal report. I created main report. In this report i right clicked and choose "insert" and "subreport". It asked to create a report with name and choose fields to display in the subreport. I did not choose anything except table. After that, I drag a field from table from "Field Explore". I changed the format of the field. I mean if data comes from table like true then I need to display "good" else "bad". I changed this by clicking the DisplayString option in "Format Object" Dialog box.

After I changed everything i ran the application what happening is, nothing is display in subreport.

What I am doing worng?

It's very urngent pls..

Thanks

R.E

re

Web Star replied to Eswaran Radhakrishnan on 23-Dec-08 01:45 AM
Adding a Subreport to the Original Report

To begin, you add a subreport to the original report.

To add a subreport

  1. Open the project you created in the previous tutorial, http://msdn.microsoft.com/en-us/library/ms227539(VS.80).aspx.
  2. From Solution Explorer, double-click the CustomersByCity report to open it.
  3. Right-click the Details gray bar and select Insert Section Below.
  4. Right-click within the new Details b section that you have created, point to Insert, and then click Subreport.

    A gray square appears around the mouse cursor.

  5. Drag the gray rectangle into the new Details b section, and then click to release.
  6. In the Insert Subreport dialog box, on the Subreport tab, select Create a subreport with the Report Wizard.
    Note   The Insert Subreport dialog box includes other options that allow you to choose an existing report and on-demand subreports. For more information on these features, see http://msdn.microsoft.com/en-us/library/ms227973(VS.80).aspx.
  7. In the New report name field, type "CustomerOrders."
  8. Click Report Wizard...
  9. In the Available Data Sources panel of the Standard Report Creation Wizard window, expand the Create New Connection folder.
    Note   In Visual Studio .NET 2002 or 2003 where Crystal Reports has not been upgraded to http://msdn.microsoft.com/en-us/library/ms225592(VS.80).aspx, the Create New Connection folder does not exist; the contents are shown at the top level.
  10. From the subfolder that opens, expand the ODBC (RDO) folder.
  11. In the ODBC (RDO) window, select the correct ODBC DSN entry for your version of Crystal Reports as explained in http://msdn.microsoft.com/en-us/library/ms225612(VS.80).aspx, and then click Finish.

    The ODBC (RDO) folder expands and shows the Xtreme Sample Database.

  12. Select the Orders table and click the > symbol to move the Orders table into the Select Tables panel, and then click Next.
  13. From the Available Fields panel, select Order ID, Order Date, Ship Date, and Ship Via.
  14. Click the > symbol to move these fields into the Fields to Display panel, and then click Finish.
  15. In the Insert Subreport dialog box, select the Link tab.
  16. In the panel Container Report field(s) to link to, in the list Available fields, expand the Customers table, select Customer ID, and then click the > symbol.
  17. In the Customers.Customer ID field link panel that appears, leave the default selections unchanged.

    These parameter and data selections auto-generate a relationship between the main report and the subreport.

  18. Click OK.

    The new subreport, CustomerOrders, is displayed within the Details b section of the Main report.

    Note   When you add a subreport to the Details section, the subreport displays for every row, which adds a performance cost to your report. If you do not need subreport information with that level of granularity, place the subreport in a Group section rather than a Details section.

You are now ready to verify the settings in the subreport.

To verify the settings in the subreport

  1. In the report Details section, double-click on the CustomerOrders subreport to view it.

    At the bottom of the designer view, navigation buttons appear for both the Main Report and the CustomerOrders subreport.

  2. If the Field Explorer is not visible, on the Crystal Reports toolbar, click Toggle Field View.
    Note   Another way to display the Field Explorer is to go to the Crystal Reports menu, and then click Field Explorer.
  3. In the Field Explorer, expand Parameter Fields.
  4. Verify that the parameter field Pm-Customers.Customer ID was auto-generated when the subreport was linked.
  5. On the Crystal Reports toolbar, click Select Expert.
  6. In the Select Expert dialog box, verify that the criteria Orders.Customer ID is equal to {Pm-Customers.Customer ID} is set, and then click OK.
  7. From the File menu, select Save All.

    You have successfully added a CustomerOrders subreport to the CustomersByCity report. In the next section, you add an OrderDateRange parameter to the subreport

  8. http://msdn.microsoft.com/en-us/library/ms227520(VS.80).aspx

TRY THIS LINK

C_A P replied to Eswaran Radhakrishnan on 23-Dec-08 04:12 AM

http://msdn.microsoft.com/en-us/library/ms227520(VS.80).aspx

http://books.google.co.in/books?id=VB1k1_COPSYC&pg=PA286&lpg=PA286&dq=insert+a+subreport+in+crystal+report&source=web&ots=lhGBLVoSB0&sig=qRcLW1NKmD2Yz3tgE8cVNmB0E8o&hl=en&sa=X&oi=book_result&resnum=1&ct=result

http://www.dotnetspider.com/forum/159868-how-create-sub-report-crystal-reports.aspx

http://www.codeguru.com/forum/showthread.php?t=348191

meir replied to Eswaran Radhakrishnan on 03-May-11 11:57 PM
I saw this post from way  back when. I have the same problem. Did you find a solution ?

Looking forward to hearing from you.


Regards
Meir