<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Grouping overwrite sorting in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736788#M4780266</link>
    <description>&lt;P&gt;Are you trying to set up sorting within the groups?  Or are you wanting to sort the data outside of the groups?&lt;/P&gt;&lt;P&gt;-Dell&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2023 20:39:34 GMT</pubDate>
    <dc:creator>DellSC</dc:creator>
    <dc:date>2023-09-22T20:39:34Z</dc:date>
    <item>
      <title>Grouping overwrite sorting</title>
      <link>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaq-p/12736787</link>
      <description>&lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;Please note that all references already updated to the latest version.&lt;/P&gt;
  &lt;P&gt;This is the code I used for sorting:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;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&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;I ended up having to add the sorting data as part of the grouping, but that messed up all the formatting.&lt;/P&gt;
  &lt;P&gt;Did anyone have any idea what's happening and if there's any possible solution?&lt;/P&gt;
  &lt;P&gt;I've been stuck in this problem for days and tried so various things which ended up with the groups overwrite everything.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 20:21:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaq-p/12736787</guid>
      <dc:creator>clthen66</dc:creator>
      <dc:date>2023-09-22T20:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping overwrite sorting</title>
      <link>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736788#M4780266</link>
      <description>&lt;P&gt;Are you trying to set up sorting within the groups?  Or are you wanting to sort the data outside of the groups?&lt;/P&gt;&lt;P&gt;-Dell&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 20:39:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736788#M4780266</guid>
      <dc:creator>DellSC</dc:creator>
      <dc:date>2023-09-22T20:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping overwrite sorting</title>
      <link>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736789#M4780267</link>
      <description>&lt;P&gt;It would be within the groups.The sorting fields might not always be the same as the group fields.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 12:24:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736789#M4780267</guid>
      <dc:creator>clthen66</dc:creator>
      <dc:date>2023-09-25T12:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping overwrite sorting</title>
      <link>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736790#M4780268</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;&lt;P&gt;What happens if you try changing the sorting in CR Designer 2016 or 2020 in the same order as your code?&lt;/P&gt;&lt;P&gt;Code is based on the same rules as CR Designer so it may be something was changed in CRD.&lt;/P&gt;&lt;P&gt;I'll get R&amp;amp;D to have a quick look at this post and see if he can duplicate the problem.&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 14:28:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/grouping-overwrite-sorting/qaa-p/12736790#M4780268</guid>
      <dc:creator>DonWilliams</dc:creator>
      <dc:date>2023-09-29T14:28:49Z</dc:date>
    </item>
  </channel>
</rss>

