1613588 - How to change the order of sort fields in a Crystal report at runtime using the Report Application Server .NET SDK.

SAP Knowledge Base Article - Public

1613588 - How to change the order of sort fields in a Crystal report at runtime using the Report Application Server .NET SDK.

Symptom

How to change the order of sort fields in a Crystal report at runtime using the Report Application Server .NET SDK.

Environment

  • Visual Studio 2005 / Visual Studio 2008
  • Crystal Reports 2008

Resolution

1. Retrieve the ReportClientDocument object from the ReportDocument object.

ISCDReportClientDocument rcd = ReportDocument.ReportClientDocument;

2. The sort fields are present in the Sorts collection which should be accessed with the below line of code only.

   rcd.DataDefController.DataDefinition.Sorts;

3. Call the Move method wherein, as arguments, pass sort objects or indices of the objects in the Sorts collection as illustrated in the below line of code.

   // Move 1st sort field to 2nd position in the Sorts collection.

  rcd.DataDefController.SortController.Move(1,2);

Keywords

KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

Crystal Reports 2008 V1