<?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: sort table values by table values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565631#M197086</link>
    <description>&lt;P&gt;Well, |sort sorts all rows by the specified columns so I don't understand what do you mean by "sorts only first column".&lt;/P&gt;</description>
    <pubDate>Thu, 02 Sep 2021 08:28:01 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-09-02T08:28:01Z</dc:date>
    <item>
      <title>sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565617#M197074</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a table with 3 columns&lt;/P&gt;&lt;P&gt;1 is strings&lt;/P&gt;&lt;P&gt;and 2 columns with numbers&lt;/P&gt;&lt;P&gt;is there a way to sort the table from the highest number to lowest from all the values in the table ?&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sarit_s_0-1630568310308.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15811iA8E96A5C112F6493/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sarit_s_0-1630568310308.png" alt="sarit_s_0-1630568310308.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;this is part of my table and i want to sort the numbers in "priority" and "silverpop" regardless if its one of them, just to see the raw with the highest value first&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 07:39:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565617#M197074</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2021-09-02T07:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565625#M197081</link>
      <description>&lt;P&gt;If I understand you correctly, you have more than one collumn and you want to sort by higher of values of those columns, right? So if you have, for example&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;12&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;c&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;d&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;6&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;e&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;7&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;f&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;37&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;g&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;5&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;h&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;You would like to have, as an output&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;f&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;37&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;e&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;7&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;12&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;g&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;5&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;d&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;6&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;c&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;h&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If so, then it's probably easiest to add a syntetic column which will be used for sorting and remove it after sorting&lt;/P&gt;&lt;PRE&gt;&amp;lt; your search &amp;gt; | eval sortcol=max(col1,col2) | sort sortcol | fields - sortcol&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Sep 2021 08:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565625#M197081</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-02T08:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565627#M197083</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;but it is sorting only the first column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype="kube:container:notificationsservice-workerservice" Message="Filtered channel context" ("ContextData.ChannelName"=SalesforceEmail OR "ContextData.ChannelName"=SalesforcePriorityEmail)
| stats count AS Priority BY "AdditionalData.Meta.NotificationType"
| rename "AdditionalData.Meta.NotificationType" As Column
| append [ search 
     sourcetype="Silverpop-Transactional-*" Message="Message was successfully sent to *"
     | stats count AS Silverpop BY "AdditionalData.additionalData.AdditionalParameters.MailingID"
     | rename "AdditionalData.additionalData.AdditionalParameters.MailingID" AS Column
     ] | eval sortcol=max(Priority,SilverPop) | sort - sortcol | fields - sortcol&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 08:19:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565627#M197083</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2021-09-02T08:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565631#M197086</link>
      <description>&lt;P&gt;Well, |sort sorts all rows by the specified columns so I don't understand what do you mean by "sorts only first column".&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 08:28:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565631#M197086</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-02T08:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565633#M197088</link>
      <description>&lt;P&gt;the result of this query sorts only the Priority column, it is ignoring the Silverpop one&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 08:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565633#M197088</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2021-09-02T08:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565641#M197096</link>
      <description>&lt;P&gt;No. It seems you have empty results in those columns. That way max(a,b) doesn't make sense if both values are not numbers. So it will not calculate an output value.&lt;/P&gt;&lt;P&gt;You might want to fillnull with a low value before doing the eval=max[...].&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 09:48:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565641#M197096</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-02T09:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: sort table values by table values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565645#M197099</link>
      <description>&lt;P&gt;sorry, its my bad, i had a typo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks, its working&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 10:02:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-table-values-by-table-values/m-p/565645#M197099</guid>
      <dc:creator>sarit_s</dc:creator>
      <dc:date>2021-09-02T10:02:02Z</dc:date>
    </item>
  </channel>
</rss>

