on 2023 Sep 22 9:21 PM
I have an windows application which collect the parameter, grouping, and sorting info and pass it to another application which load the crystal report. Recently I updated the runtime engine to SP34 and a having issue with the grouping keeps overwrites the sorting data.
Please note that all references already updated to the latest version.
This is the code I used for sorting:
Dim reportClientDocument As ISCDReportClientDocument = reportDoc.ReportClientDocument
Dim dataDefController As DataDefController = reportClientDocument.DataDefController
Dim resultFields As Fields = dataDefController.DataDefinition.ResultFields
Dim sortField As Field = DirectCast(resultFields.FindField(fieldName, CrystalDecisions.ReportAppServer.DataDefModel.CrFieldDisplayNameTypeEnum.crFieldDisplayNameFormula, CrystalDecisions.ReportAppServer.DataDefModel.CeLocale.ceLocaleEnglishUS), Field)
Dim sortController As SortController = dataDefController.SortController
If sortController.CanSortOn(sortField) Then
Dim sort As ISCRSort = sortController.FindSort(sortField)
If sort Is Nothing Then
Dim newSort As New Sort With {
.SortField = sortField,
.Direction = sortDirection
}
Dim existingGroup As Sort = CType(sortController.FindSort(sortField), Sort)
If existingGroup Is Nothing Then
sortController.Add(sortLevel - 1, newSort)
sortController.ModifySortDirection(sortLevel - 1, sortDirection)
Else
ModifySortDirection(reportClientDocument, fieldName, sortDirection)
End If
Else
ModifySortDirection(reportClientDocument, fieldName, sortDirection)
End If
End If<br>
Unfortunately, each time it's done adding all the sorting and moved to the next line of code, the grouping data replace everything on the sorting with whatever it had.
I ended up having to add the sorting data as part of the grouping, but that messed up all the formatting.
Did anyone have any idea what's happening and if there's any possible solution?
I've been stuck in this problem for days and tried so various things which ended up with the groups overwrite everything.
Request clarification before answering.
Hi Cynthia,
What happens if you try changing the sorting in CR Designer 2016 or 2020 in the same order as your code?
Code is based on the same rules as CR Designer so it may be something was changed in CRD.
I'll get R&D to have a quick look at this post and see if he can duplicate the problem.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.