VB6 Crystal Report Code to C# conversion

478 views Asked by At

So I am moving some existing Crystal Reports from VB6 invoked code to C#.

The VB6 Crystal Report engine has a GroupSortFields collection that is set at runtime along with the SortFields collection.

Code looks like this.

crystalReportEngine.GroupSortFields(0) = somepassedinstring
crystalReportEngine.SortFields(0) = somepassedinstring

Was able to figure out how to set the SortFields in C#, but cant find any documentation to set the GroupSortFields.

Any direction?

UPDATE: Here is a simplified version of the legacy VB6 code.

CR1.ReportFileName = fullPathAndFileNameToRpt
CR1.Connect = dataConnectionString
CR1.ParameterFields(0) = "SortField;" & rptParameter & ";TRUE"
CR1.SelectionFormula = ""{Manager_Category1.List}"="SomeValue""
CR1.GroupSortFields(0) = "Sum({@ABSWeightedValue},{Manager_Category1.Category1})"
CR1.SortFields(0) = "{@ABSWeightedValue}"
CR1.PrinterStartPage = 1
CR1.PrinterStopPage = 1
1

There are 1 answers

1
jjj On

Are you looking for SortFields[i].SortType?

That can be set to SortFieldType.GroupSortField or SortFieldType.RecordSortField.