SAP Knowledge Base Article - Public

1394692 - How to add a Subreport Link using the Crystal Reports .NET inproc RAS SDK ?

Symptom

How to add a Subreport Link using the Crystal Reports .NET inproc RAS SDK ?

Reproducing the Issue

.NET Visual Studio 2005
C#

Resolution

 

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;

// Create a new ReportDocument
m_boReportDocument = new ReportDocument();
// Load the RPT file
m_boReportDocument.Load("..\\..\\MainSubnoLink.rpt");

// Access the ReportClientDocument in the ReportDocument (EROM bridge)
m_boReportClientDocument = m_boReportDocument.ReportClientDocument;

 

// Define the SubreportLink list
m_boSubreportLinks = new CrystalDecisions.ReportAppServer.ReportDefModel.SubreportLinks();

//Define the SubreportLink
m_boSubreportLink = new CrystalDecisions.ReportAppServer.ReportDefModel.SubreportLink();

 

m_boSubreportLink.MainReportFieldName = "{Orders.Order ID}";
m_boSubreportLink.SubreportFieldName = "{Orders_Detail.Order ID}";

// Add subreport link to subreport list
m_boSubreportLinks.Add(m_boSubreportLink);

// Set the subreport link
m_boReportClientDocument.SubreportController.SetSubreportLinks("subreport_unlinked", m_boSubreportLinks);

 

// Display in reportviewer
crystalReportViewer1.ReportSource = m_boReportDocument;

Keywords

How addSubreport Sub Report Link  Crystal Reports .NET inproc RAS SDK , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports XI R2