<?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: Sorting by FormulaField in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaa-p/12391311#M4637301</link>
    <description>&lt;P&gt;Hi Joseph,&lt;/P&gt;&lt;P&gt;Was that the RDC you used to use?&lt;/P&gt;&lt;P&gt;I don't see an obvious way but asking others if they know of any way to sort the list.&lt;/P&gt;&lt;P&gt;In CR Designer you can right click and sort them but the same report returns them in order you added them...&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;</description>
    <pubDate>Fri, 28 May 2021 22:18:41 GMT</pubDate>
    <dc:creator>former_member11696</dc:creator>
    <dc:date>2021-05-28T22:18:41Z</dc:date>
    <item>
      <title>Sorting by FormulaField</title>
      <link>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaq-p/12391309</link>
      <description>&lt;P&gt;I've begun the task of bringing out CR to the 21st century. The templates were created more than 10 years ago, as well as the application written in Visual Basic that allows a user to pick different options before they click a button for generating a report.&lt;/P&gt;
  &lt;P&gt;So far the process hasn't been too bad but I've stumbled upon something that I can't figure out.&lt;/P&gt;
  &lt;P&gt;In VB, there's a line of code that sorts the report by a database table field:&lt;/P&gt;
  &lt;P&gt;Report.RecordSortFields.Add Report.Database.Tables(1).fields.GetItemByName("Name"), crAscendingOrder&lt;/P&gt;
  &lt;P&gt;I've successfully got that same logic working using the lines below&lt;/P&gt;
  &lt;P&gt;DatabaseFieldDefinition databaseFieldDefinition = Report.Database.Tables["Bureau"].Fields["Name"]; &lt;/P&gt;
  &lt;P&gt; SortField sortField = Report.DataDefinition.SortFields[0]; &lt;/P&gt;
  &lt;P&gt; sortField.Field = databaseFieldDefinition; &lt;/P&gt;
  &lt;P&gt; sortField.SortDirection = SortDirection.AscendingOrder;&lt;/P&gt;
  &lt;P&gt;The other type of sorting is what I'm struggling with.&lt;/P&gt;
  &lt;P&gt;The VB line of code is:&lt;BR /&gt;Report.RecordSortFields.Add Report.FormulaFields.GetItemByName("AssetName"), crAscendingOrder&lt;/P&gt;
  &lt;P&gt;As you can see, unlike the above example this is sorting by formula field. I can't seem to figure out how to write the code for this.&lt;/P&gt;
  &lt;P&gt;I know I can get the formula field using the below line but can't seem to make it work:&lt;/P&gt;
  &lt;P&gt;Report.DataDefinition.FormulaFields["AssetName"];&lt;/P&gt;
  &lt;P&gt;Any help would be appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 00:02:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaq-p/12391309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-05-26T00:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by FormulaField</title>
      <link>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaa-p/12391310#M4637300</link>
      <description>&lt;P&gt;Hi Joseph,&lt;/P&gt;&lt;P&gt;I updated your primary tag to "SAP Crystal Reports, version for Visual Studio" because you're asking about how to do something in code.  The "SAP Crystal Reports" tag is for questions about designing reports.&lt;/P&gt;&lt;P&gt;-Dell Stinnett-Christy&lt;BR /&gt; Moderator&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 13:27:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaa-p/12391310#M4637300</guid>
      <dc:creator>DellSC</dc:creator>
      <dc:date>2021-05-26T13:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by FormulaField</title>
      <link>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaa-p/12391311#M4637301</link>
      <description>&lt;P&gt;Hi Joseph,&lt;/P&gt;&lt;P&gt;Was that the RDC you used to use?&lt;/P&gt;&lt;P&gt;I don't see an obvious way but asking others if they know of any way to sort the list.&lt;/P&gt;&lt;P&gt;In CR Designer you can right click and sort them but the same report returns them in order you added them...&lt;/P&gt;&lt;P&gt;Don&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 22:18:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sorting-by-formulafield/qaa-p/12391311#M4637301</guid>
      <dc:creator>former_member11696</dc:creator>
      <dc:date>2021-05-28T22:18:41Z</dc:date>
    </item>
  </channel>
</rss>

