SAP Knowledge Base Article - Public

1591686 - How to add sort fields using the Inproc RAS SDK

Symptom

Want to add sorting to a Crystal Report at runtime.

Resolution

The code snippets below use the Inproc RAS SDK:

VB.NET

Dim myReport As New ReportDocument()
myReport.Load("C:\test.rpt")
Dim testSort As New Sort()
testSort.SortField = myReport.ReportClientDocument.DataDefController.Database.Tables(0).DataFields(1)
myReport.ReportClientDocument.DataDefController.SortController.Add(0, testSort)

C#

ReportDocument myReport = new ReportDocument();
myReport.Load(@"C:\test.rpt");
Sort testSort = new Sort();
testSort.SortField = myReport.ReportClientDocument.DataDefController.Database.Tables[0].DataFields[1];
myReport.ReportClientDocument.DataDefController.SortController.Add(0, testSort); 

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

Crystal Reports 2008 V0