SAP Knowledge Base Article - Public

1913575 - How to delete a group field from a Crystal report at runtime?


How to delete a group field from a Crystal report at runtime?


  • SAP Crystal Reports, Developer version for Microsoft Visual Studio.
  • Visual Studio


Here is C# sample code developed using Crystal Reports InProc RAS .NET SDK to delete a group from a report.

CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();


ISCDReportClientDocument boReportClientDocument;

boReportClientDocument = rd.ReportClientDocument;
int groupCount = boReportClientDocument.DataDefinition.Groups.Count;

if (groupCount > 0)


for (int i = 0; i < groupCount; i++)


CrystalDecisions.ReportAppServer.DataDefModel.Group group = boReportClientDocument.DataDefinition.Groups[i];
// Remove the group

//Note: when removing group by index you lessen the group count by 1 each time a group is removed
// recommended to remove group by name not index
// or remove groups in reverse order.

CrystalReportViewer1.ReportSource = rd;



bi, sap, beginner, business_intelligence_(businessobjects), sap_crystal_reports, visual, for, .net, crforvs, crvs2010, studio, sdk, crystal_reports,, cr, formula, crystal_reports_for_visual_studio_2010,, business_intelligence_(business, crystal_reports_2008, groupfield, group expert, crystal_report, code_resuability, crvs, cr2008,, cr4vs2010, vs2012, Visual studio 2012, .net 4, crfor .net , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To


Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio