<?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>topic Re: Linq Sort in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660342#M16928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yea but there was nothing in there about sorting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is where I am having my problems...I can sort the text but not the integer...I have scoured the internet and cant find anything...I am unfamilar with TypeCast, DirectCast syntax in this instant...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VB example you posted&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim results = From g In graphicCollection Group g By GroupKey = CStr(g.Attributes("Officer")) Into r = Group Select New With {Key .Officer = GroupKey, Key .Incidents = r.Sum(Function(i) Convert.ToInt32(i.Attributes("Incident")))}
For Each item In results
MessageBox.Show(String.Format("Officer {0} has {1}", item.Officer, item.Incidents))
Next item&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my appempt at sorting...I assume that I should be grabbing the Actual Field Name (incidentNum) instead of the created attribute (IncidentNums with an s)&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order By CStr(g.Attributes("IncidentNum")) Ascending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = CStr(g.Attributes("Officer")) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Variations tried&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Order By CType(g.Attributes("IncidentNum"), Integer) Descending
Order By DirectCast(g.Attributes("IncidentNum"), Integer) Descending
Order By TryCast(g.Attributes("IncidentNum"), String) Descending&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:56:01 GMT</pubDate>
    <dc:creator>JayKappy</dc:creator>
    <dc:date>2021-12-12T03:56:01Z</dc:date>
    <item>
      <title>Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660334#M16920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been trying to find an answer at Silverlight forums and LINQ forums but no luck....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can sort by "officer" no problem....but I want to sort by the IncidentNumber field which is numberic...Cant seem to get it to sort...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;I tried with no success:&lt;/STRONG&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Order By CStr(g.Attributes("IncidentNum")) Ascending&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Order By CInt(g.Attributes("IncidentNum")) Ascending&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Order By CDbl(g.Attributes("IncidentNum")) Ascending&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;STRONG&gt;Works for Officer:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order By CStr(g.Attributes("Officer")) Ascending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = CStr(g.Attributes("Officer")) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Does NOT work for IncidentNumber (Map Service Field Name = IncidentNum)&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order By CStr(g.Attributes("IncidentNum")) Ascending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = CStr(g.Attributes("Officer")) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2011 20:15:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660334#M16920</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-11T20:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660335#M16921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anyoen any ideas....The field "IncidentNum" is numeric...I am Creating the "IncidentNums" (with an s) in the LINQ query...but wont sort on the IncidentNums, I can only get it to sort by the text field Officers....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uggggggggggggg&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 12:43:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660335#M16921</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-14T12:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660336#M16922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is this still the same sample from your previous thread? I was able to sort using Linq in C#. You need to apply type cast on the attribute value from object, it should be int or double, whichever matches your field data type. If you cast it to string, then the sort will be 1, 12, 4, instead of 1, 4, 12.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 15:56:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660336#M16922</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-03-14T15:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660337#M16923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is this still the same sample from your previous thread? I was able to sort using Linq in C#. You need to apply type cast on the attribute value from object, it should be int or double, whichever matches your field data type. If you cast it to string, then the sort will be 1, 12, 4, instead of 1, 4, 12.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yea I was trying to find the old entry...I cant find it...I think it was in one that a bunc h of issues were dealt with....Still triyng to find it....Looking up Type Cast right now...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 16:53:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660337#M16923</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-14T16:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660338#M16924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This was your old thread: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/23447-Query-BrainStorm"&gt;http://forums.arcgis.com/threads/23447-Query-BrainStorm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 16:58:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660338#M16924</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-03-14T16:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660339#M16925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Didnt really want to post there...as the post was to get the LINQ query working....it was working...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dindnt want to get lost in 5 issues in the same forum...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was thinking soemthing like this?&amp;nbsp; But no go....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By CType(g.Attributes("IncidentNum"), Integer) Descending&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AND &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By DirectCast(g.Attributes("IncidentNum"), Integer) Descending&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By TryCast(g.Attributes("IncidentNum"), String) Descending&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Right Path?&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 17:05:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660339#M16925</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-14T17:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660340#M16926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Again not sure by what you mean &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;You need to apply type cast on the attribute value from object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have looked this up for examples and as you can see above this is all I am really coming up with...Not really following here....I have been all over the interenet here tryign to figure this out....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 18:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660340#M16926</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2011-03-17T18:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660341#M16927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you use the attached VB solution that is equivalent to the C# code I posted in your old forum?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Mar 2011 19:47:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660341#M16927</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-03-17T19:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660342#M16928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yea but there was nothing in there about sorting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is where I am having my problems...I can sort the text but not the integer...I have scoured the internet and cant find anything...I am unfamilar with TypeCast, DirectCast syntax in this instant...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VB example you posted&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim results = From g In graphicCollection Group g By GroupKey = CStr(g.Attributes("Officer")) Into r = Group Select New With {Key .Officer = GroupKey, Key .Incidents = r.Sum(Function(i) Convert.ToInt32(i.Attributes("Incident")))}
For Each item In results
MessageBox.Show(String.Format("Officer {0} has {1}", item.Officer, item.Incidents))
Next item&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my appempt at sorting...I assume that I should be grabbing the Actual Field Name (incidentNum) instead of the created attribute (IncidentNums with an s)&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order By CStr(g.Attributes("IncidentNum")) Ascending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = CStr(g.Attributes("Officer")) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Variations tried&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Order By CType(g.Attributes("IncidentNum"), Integer) Descending
Order By DirectCast(g.Attributes("IncidentNum"), Integer) Descending
Order By TryCast(g.Attributes("IncidentNum"), String) Descending&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:56:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660342#M16928</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2021-12-12T03:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660343#M16929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&amp;nbsp; Dim results = From g In featureSet&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = CStr(g.Attributes("Incident")) Into r = Group&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Incident = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From your last post in the old thread the code above worked for you. Can't you just use Convert.ToInt32() then?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 16:14:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660343#M16929</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-03-18T16:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660344#M16930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Field is an Integer.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tried using the actual Attribute field name "IncidentNum", NOTHING ..no sorting&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order By Convert.ToInt32(g.Attributes("IncidentNum")) Descending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = DirectCast(g.Attributes("Officer"), String) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But then thinking...&lt;/SPAN&gt;&lt;STRONG&gt;I am trying to sort the "Key .IncidentNums" being created by Sum&lt;/STRONG&gt;&lt;SPAN&gt;, NOTHING ...no sortting...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order By Convert.ToInt32(g.Attributes("IncidentNums")) Descending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = DirectCast(g.Attributes("Officer"), String) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also...but getting errors&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By Convert.ToInt32(g.Attributes("IncidentNum"), Integer) Descending&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By Convert.ToInt32(g.Attributes("IncidentNum"), Double) Descending&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By Convert.ToInt32(g.Attributes("IncidentNums"), Integer) Descending&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Order By Convert.ToInt32(g.Attributes("IncidentNums"), Double) Descending&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:44:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660344#M16930</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2021-12-12T16:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660345#M16931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Before you apply any sort, test that you can successfully perform the conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Dim integerValue As Integer = Convert.ToInt32(g.Attributes("IncidentNum"))
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can get the above code to work, I don't see why sorting against this value will not work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:56:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660345#M16931</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T03:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Linq Sort</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660346#M16932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;first off once again I thank you with this issue....driving me nuts...I am trying my best which does nto seem to be enough....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;problem is that alone g is undefined...I am defining g from the results of the query (featureset)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub QueryTaskPolice_ExecuteCompletedListBox(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim featureSet As FeatureSet = args.FeatureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Group g By GroupKey = DirectCast(g.Attributes("Officer"), String) Into r = Group
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select New With {Key .Officer = GroupKey, Key .IncidentNums = r.Sum(Function(i) Convert.ToInt32(i.Attributes("IncidentNum")))}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I do this, I get the error that g is undefined...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub QueryTaskPolice_ExecuteCompletedListBox(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim featureSet As FeatureSet = args.FeatureSet

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim integerValue As Integer = Convert.ToInt32(g.Attributes("IncidentNum"))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then tried..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim integerValue As Integer = Convert.ToInt32(featureSet.Attributes("IncidentNum"))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;.Error 1 'Attributes' is not a member of 'ESRI.ArcGIS.Client.Tasks.FeatureSet'.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then tried this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim results2 = From g In featureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim integerValue As Integer = Convert.ToInt32(results2.Attributes("IncidentNum"))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Error 1 'Attributes' is not a member of 'System.Collections.Generic.IEnumerable(Of&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;uggggggggggggggggg&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:44:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/linq-sort/m-p/660346#M16932</guid>
      <dc:creator>JayKappy</dc:creator>
      <dc:date>2021-12-12T16:44:41Z</dc:date>
    </item>
  </channel>
</rss>

