<?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 Map Viewer Template Sorting in ArcGIS AppStudio Questions</title>
    <link>https://community.esri.com/t5/arcgis-appstudio-questions/map-viewer-template-sorting/m-p/834107#M2372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working with the Map Viewer template and I want the results returned from the Feature Search (SearchPage.qml) to be sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a web map with 8 layers with 3 layers that have searching enabled.&amp;nbsp; For example I have a layer of parcels that I search by Owner Name and a Subdivision layer that I search by Subdivision Name.&amp;nbsp; When the results are returned I would like to have the Parcel results sorted by Owner Name and the Subdivision results sorted by Subdivision Name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example - when I search for Carlson (an owner name and a subdivision name) (or a floor cleaner and a dessert topping) I get the following unsorted results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/477646_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;My users would really like the results to be sorted within each layer.&amp;nbsp; I've attempted to add orderByFields to the SearchPage.qml in the QueryParameters with mixed results.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #c0c0c0;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;QueryParameters&lt;/SPAN&gt;&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;{
&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;id&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;&lt;SPAN&gt;featureParameters
&lt;/SPAN&gt;&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;maxFeatures&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;50
&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;orderByFields&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;[
&lt;SPAN style="color: #c0c0c0;"&gt;            &lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;OrderBy&lt;/SPAN&gt;&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;{
&lt;SPAN style="color: #c0c0c0;"&gt;                &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;fieldName&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;"NAME"&lt;/SPAN&gt;;
&lt;SPAN style="color: #c0c0c0;"&gt;                &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;sortOrder&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;Enums&lt;/SPAN&gt;.SortOrderAscending
&lt;SPAN style="color: #c0c0c0;"&gt;            &lt;/SPAN&gt;}
&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;]
&lt;SPAN style="color: #c0c0c0;"&gt;    &lt;/SPAN&gt;}

Adding this also requires&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #008000; "&gt;featuresModel.sortByStringAttribute("layerName") to be changed to
&lt;/SPAN&gt;featuresModel.sortByStringAttribute("NAME") in SearchPage.qml -&amp;gt; onFeatureSearchCompleted:&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;This works for the Parcel layer but not for the Subdivision layer.&amp;nbsp; It obviously only works for one layer.&amp;nbsp; I'm unsure how to add distinct query parameters for each layer that is being searched.&amp;nbsp; Doing this also drops the search results from the Subdivision layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked at the sorts in CustomListModel.qml, but I've been unable to achieve my desired sorted results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I modify the Map Viewer Template to sort the results of a feature search for each searched layer in my web map?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure there is a simple and elegant solution to this problem.&amp;nbsp; Any insight that you can provide will be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:06:27 GMT</pubDate>
    <dc:creator>DanHuerter2</dc:creator>
    <dc:date>2021-12-12T10:06:27Z</dc:date>
    <item>
      <title>Map Viewer Template Sorting</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/map-viewer-template-sorting/m-p/834107#M2372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working with the Map Viewer template and I want the results returned from the Feature Search (SearchPage.qml) to be sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a web map with 8 layers with 3 layers that have searching enabled.&amp;nbsp; For example I have a layer of parcels that I search by Owner Name and a Subdivision layer that I search by Subdivision Name.&amp;nbsp; When the results are returned I would like to have the Parcel results sorted by Owner Name and the Subdivision results sorted by Subdivision Name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example - when I search for Carlson (an owner name and a subdivision name) (or a floor cleaner and a dessert topping) I get the following unsorted results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/477646_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;My users would really like the results to be sorted within each layer.&amp;nbsp; I've attempted to add orderByFields to the SearchPage.qml in the QueryParameters with mixed results.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #c0c0c0;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;QueryParameters&lt;/SPAN&gt;&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;{
&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;id&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;&lt;SPAN&gt;featureParameters
&lt;/SPAN&gt;&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;maxFeatures&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;50
&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;orderByFields&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;[
&lt;SPAN style="color: #c0c0c0;"&gt;            &lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;OrderBy&lt;/SPAN&gt;&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;{
&lt;SPAN style="color: #c0c0c0;"&gt;                &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;fieldName&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;"NAME"&lt;/SPAN&gt;;
&lt;SPAN style="color: #c0c0c0;"&gt;                &lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;sortOrder&lt;/SPAN&gt;:&lt;SPAN style="color: #c0c0c0;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;Enums&lt;/SPAN&gt;.SortOrderAscending
&lt;SPAN style="color: #c0c0c0;"&gt;            &lt;/SPAN&gt;}
&lt;SPAN style="color: #c0c0c0;"&gt;        &lt;/SPAN&gt;]
&lt;SPAN style="color: #c0c0c0;"&gt;    &lt;/SPAN&gt;}

Adding this also requires&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #008000; "&gt;featuresModel.sortByStringAttribute("layerName") to be changed to
&lt;/SPAN&gt;featuresModel.sortByStringAttribute("NAME") in SearchPage.qml -&amp;gt; onFeatureSearchCompleted:&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;This works for the Parcel layer but not for the Subdivision layer.&amp;nbsp; It obviously only works for one layer.&amp;nbsp; I'm unsure how to add distinct query parameters for each layer that is being searched.&amp;nbsp; Doing this also drops the search results from the Subdivision layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked at the sorts in CustomListModel.qml, but I've been unable to achieve my desired sorted results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I modify the Map Viewer Template to sort the results of a feature search for each searched layer in my web map?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure there is a simple and elegant solution to this problem.&amp;nbsp; Any insight that you can provide will be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:06:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/map-viewer-template-sorting/m-p/834107#M2372</guid>
      <dc:creator>DanHuerter2</dc:creator>
      <dc:date>2021-12-12T10:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Map Viewer Template Sorting</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/map-viewer-template-sorting/m-p/834108#M2373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this can be done if we sort the result of each layer on the client-side.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, on MapViewer/view/SearchPage.qml on the signal OnFeatureSearchCompleted, the featuresModel is sorted by "layerName" attribute. The modification would around this logic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/478294_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the function sortByStringAttribute on MapViewer/controls/CustomListModel.qml&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/478304_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is helpful,&lt;/P&gt;&lt;P&gt;Erwin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2020 21:21:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/map-viewer-template-sorting/m-p/834108#M2373</guid>
      <dc:creator>ErwinSoekianto</dc:creator>
      <dc:date>2020-01-13T21:21:49Z</dc:date>
    </item>
  </channel>
</rss>

