<?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: Why does this search not sort in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579860#M47494</link>
    <description>&lt;P&gt;By the time you are sorting, s is already a multivalue field. Try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sr_prd sourcetype=batch_roylink earliest=-7d@d
| eval s=strptime(Scheduled_Batch_StartTime, "%Y-%m-%d %H:%M:%S.%Q")
| eval e=strptime(Scheduled_Batch_Endtime, "%Y-%m-%d %H:%M:%S.%Q")
| eval s=round(s,2)
| eval e=round(e,2)
| eval r=tostring(e-s, "duration")
| rename "Scheduled_Batch_StartTime" as "Start Time", "Scheduled_Batch_Endtime" as "End Time", r as "Runtime (H:M:S)"
| sort s
| stats list(s) as "s", list("Start Time") as "Start Time",list("End Time") as "End Time", list("Runtime (H:M:S)") as "Runtime (H:M:S)" by Task_Object
| search Task_Object = Roylink_Upload&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 04 Jan 2022 12:03:39 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-01-04T12:03:39Z</dc:date>
    <item>
      <title>Why does this search not sort</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579855#M47490</link>
      <description>&lt;P&gt;I am running this search to return batch job run times.&lt;/P&gt;&lt;P&gt;index=sr_prd sourcetype=batch_roylink earliest=-7d@d&lt;BR /&gt;| eval s=strptime(Scheduled_Batch_StartTime, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval e=strptime(Scheduled_Batch_Endtime, "%Y-%m-%d %H:%M:%S.%Q")&lt;BR /&gt;| eval s=round(s,2)&lt;BR /&gt;| eval e=round(e,2)&lt;BR /&gt;| eval r=tostring(e-s, "duration")&lt;BR /&gt;| rename "Scheduled_Batch_StartTime" as "Start Time", "Scheduled_Batch_Endtime" as "End Time", r as "Runtime (H:M:S)"&lt;BR /&gt;| stats list(s) as "s", list("Start Time") as "Start Time",list("End Time") as "End Time", list("Runtime (H:M:S)") as "Runtime (H:M:S)" by Task_Object&lt;BR /&gt;| search Task_Object = Roylink_Upload&lt;BR /&gt;| sort s&lt;/P&gt;&lt;P&gt;Even though 's' is a numeric string, the results are not returning in search order -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="timrich66_0-1641297015475.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17407iAA0D4C8F4B96CD9A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="timrich66_0-1641297015475.png" alt="timrich66_0-1641297015475.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any ideas why this is happening?&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 11:51:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579855#M47490</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2022-01-04T11:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this search not sort</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579860#M47494</link>
      <description>&lt;P&gt;By the time you are sorting, s is already a multivalue field. Try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sr_prd sourcetype=batch_roylink earliest=-7d@d
| eval s=strptime(Scheduled_Batch_StartTime, "%Y-%m-%d %H:%M:%S.%Q")
| eval e=strptime(Scheduled_Batch_Endtime, "%Y-%m-%d %H:%M:%S.%Q")
| eval s=round(s,2)
| eval e=round(e,2)
| eval r=tostring(e-s, "duration")
| rename "Scheduled_Batch_StartTime" as "Start Time", "Scheduled_Batch_Endtime" as "End Time", r as "Runtime (H:M:S)"
| sort s
| stats list(s) as "s", list("Start Time") as "Start Time",list("End Time") as "End Time", list("Runtime (H:M:S)") as "Runtime (H:M:S)" by Task_Object
| search Task_Object = Roylink_Upload&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Jan 2022 12:03:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579860#M47494</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-04T12:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this search not sort</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579864#M47497</link>
      <description>&lt;P&gt;Thank you, that is perfect.&amp;nbsp; (I've removed 's' from the final table as not required).&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 12:16:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579864#M47497</guid>
      <dc:creator>timrich66</dc:creator>
      <dc:date>2022-01-04T12:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why does this search not sort</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579866#M47499</link>
      <description>&lt;P&gt;As suggested on the previous reply, &lt;STRONG&gt;| stats list(s) as "s"&lt;/STRONG&gt; this will list out all values of "s" and assign it "s"... simply making it the field "s" as a multivalue field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, run the sort command before doing this stats list operation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 12:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-this-search-not-sort/m-p/579866#M47499</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2022-01-04T12:20:42Z</dc:date>
    </item>
  </channel>
</rss>

