<?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: How do you sort by a specific order by the values of a field? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534183#M36380</link>
    <description>&lt;P&gt;Yes, it works.&lt;BR /&gt;When i put it in the XML i get "Uencoded &amp;lt;" error.&lt;BR /&gt;how can i escape it?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Dec 2020 07:46:51 GMT</pubDate>
    <dc:creator>D_D</dc:creator>
    <dc:date>2020-12-28T07:46:51Z</dc:date>
    <item>
      <title>How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534154#M36375</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm struggling with sorting bar chart columns based on a time value.&lt;BR /&gt;&lt;BR /&gt;I have the following in my search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| chart last(duration) as duration over run_id by task_id&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;and I get the following table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;run_id	task_1		 task_2	 	task_3	 	task_4		 
1	14.55000000	1.60000000	11.55000000	1.78333333
2	13.93333333	2.73333333	13.55000000	1.91666667&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in the stacked chart visualization the tasks are showing from top to bottom in the order of the tasks column (first task_1 then task_2, etc).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;current bar char stacked:
----------------
|              | &amp;lt;- task_1
|              | &amp;lt;- task_2
|              | &amp;lt;- task_3
|              | &amp;lt;- task_4&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;i want to sort the task_id colums based on a value (start time) which i have on the initial search (pre charting) for each of the tasks.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bar char stacked i want to have:
---------------
|              | &amp;lt;- task with highest start time
|              | &amp;lt;- task_2
|              | &amp;lt;- task_3
|              | &amp;lt;- task with lowest start time&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;is it possible to do that?&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 08:35:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534154#M36375</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T08:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534173#M36377</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230008"&gt;@D_D&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;The chart command while creating the columns would by default sort the field task_id as it has been mentioned in the by clause.&lt;BR /&gt;I think you can create a dummy field which is a string joining the start time and task_id and use that field in the by clause of the chart command.&amp;nbsp;The column names can be renamed using foreach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval dummy_sort = start_time."_".task_id
| chart last(duration) as duration over run_id by dummy_sort
| foreach *task_* [rename &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; to task_&amp;lt;&amp;lt;MATCHSEG2&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There may be a simpler way to do this.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 06:32:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534173#M36377</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T06:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534180#M36378</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Thank you, aprrcaite you reply.&lt;BR /&gt;i think it might work the issue is the column names aren't task_1, task_2, etc... it was an example to simplify thinks, they have different name for each column, can i run over them with foreach loop and regex like (*_*) where first&amp;nbsp;asterisk is the "starttime" and the second is the "task name"?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 07:27:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534180#M36378</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T07:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534182#M36379</link>
      <description>&lt;P&gt;Yes, you can use that. The foreach would look something like this then:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach *_* [rename &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; to &amp;lt;&amp;lt;MATCHSEG2&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 07:42:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534182#M36379</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T07:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534183#M36380</link>
      <description>&lt;P&gt;Yes, it works.&lt;BR /&gt;When i put it in the XML i get "Uencoded &amp;lt;" error.&lt;BR /&gt;how can i escape it?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 07:46:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534183#M36380</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T07:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534184#M36381</link>
      <description>&lt;P&gt;&amp;lt;&amp;nbsp; would be &amp;amp;lt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp; would be &amp;amp;gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 07:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534184#M36381</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T07:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534185#M36382</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;This is also works.&lt;BR /&gt;It still takes the columns from left to right,&lt;BR /&gt;right now:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bar char stacked i have:
---------------
|              | &amp;lt;- task with lowest start time
|              | &amp;lt;- task_2
|              | &amp;lt;- task_3
|              | &amp;lt;- task with highest start time&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;can i reverse it somehow?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bar char stacked i want to have:
---------------
|              | &amp;lt;- task with highest start time
|              | &amp;lt;- task_2
|              | &amp;lt;- task_3
|              | &amp;lt;- task with lowest start time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 07:58:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534185#M36382</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T07:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534189#M36383</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Found a corner case where it doesn't work.&lt;/P&gt;&lt;P&gt;when i use "dummy sort" i get alot of values with 0, then the foreach loops get them instead the actual values.&lt;/P&gt;&lt;P&gt;it happens when there is more then one value of "run_id"&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 08:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534189#M36383</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T08:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534194#M36386</link>
      <description>&lt;P&gt;You are getting 0 in the column names or the field values?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 08:37:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534194#M36386</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T08:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534195#M36387</link>
      <description>&lt;P&gt;In the fields values,&lt;BR /&gt;for each run_id i get:&lt;BR /&gt;(num of tasks) * (num of run id).&lt;BR /&gt;table size is:&lt;BR /&gt;run_id rows and&amp;nbsp;(num of tasks) * (num of run id) columns&lt;BR /&gt;for each run_id row there is&amp;nbsp;(num of tasks) fields with value, the rest are 0.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 08:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534195#M36387</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T08:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534197#M36388</link>
      <description>&lt;P&gt;Can you please share screenshots of the result obtained in table as well as the chart?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 08:45:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534197#M36388</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T08:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534204#M36389</link>
      <description>&lt;P&gt;Yes,&lt;BR /&gt;before foreach operation:&lt;BR /&gt;table (this has more columns on the right side)&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="capture - Copy.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12371iA4417369A907BAEB/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture - Copy.png" alt="capture - Copy.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;chart:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="capture1 - Copy.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12373i2474542207C6CC9B/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture1 - Copy.PNG" alt="capture1 - Copy.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;after foreach operation (table + chart):&lt;BR /&gt;this is all the columns in the tables.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="capture2 - Copy.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12372iB8BC966B69A7CF9A/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture2 - Copy.PNG" alt="capture2 - Copy.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;the deleted part in the pictures is the task name.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 09:32:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534204#M36389</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T09:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534214#M36392</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;In the data, is it expected that same task_id can have different start time depending for the same run_id?&lt;BR /&gt;So for eg, task_id&amp;nbsp; "task_1" has maybe started twice for run_id "run_1". This will create two different field values like time1_task_1 and time2_task_2 in the dummy_sort field. However, on column rename both would have name&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If so, then the solution may be creating the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 12:46:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534214#M36392</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T12:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534215#M36393</link>
      <description>&lt;P&gt;To your question "&lt;SPAN&gt;In the data, is it expected that same task_id can have different start time depending for the same run_id?"&lt;BR /&gt;The answer is yes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to overcome this issue?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 12:48:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534215#M36393</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T12:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534222#M36397</link>
      <description>&lt;P&gt;In the original query that you posted in the question, you have been taking the latest duration for every task_id and run_id in the chart.&lt;BR /&gt;If we go according to that, then, it seems we need to take into account the starttime of the task_id for the latest duration obtained.&lt;BR /&gt;I think that would also solve our problem of having duplicate task_ids.&lt;BR /&gt;&lt;BR /&gt;For that the dummy_sort can be calculated after we have got the events having last duration for the task_id and run_id:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats last(duration) as last_duration by run_id, task_id
| where duration = last_duration
| eval dummy_sort = starttime."_".task_id 
| chart last(last_duration) as duration over run_id by dummy_sort 
| foreach *_* 
    [ rename &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; to &amp;lt;&amp;lt;MATCHSEG2&amp;gt;&amp;gt;
        ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 13:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534222#M36397</guid>
      <dc:creator>t_shreya</dc:creator>
      <dc:date>2020-12-28T13:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you sort by a specific order by the values of a field?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534224#M36398</link>
      <description>&lt;P&gt;i added "limit=0" to the chart command to avoid "OTHER", but i get the same results as before.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 13:40:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-you-sort-by-a-specific-order-by-the-values-of-a-field/m-p/534224#M36398</guid>
      <dc:creator>D_D</dc:creator>
      <dc:date>2020-12-28T13:40:05Z</dc:date>
    </item>
  </channel>
</rss>

