<?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: Changing table column header names in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64786#M43953</link>
    <description>&lt;P&gt;appendcols doesn't work because there isn't a 1 to 1 mapping of columns. in the example above, "VisitorsWhoX" may be null for 0-10 (I could set to 0 if isnull though). &lt;BR /&gt;
 rename: perfect. thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Sep 2012 14:47:29 GMT</pubDate>
    <dc:creator>brettcave</dc:creator>
    <dc:date>2012-09-19T14:47:29Z</dc:date>
    <item>
      <title>Changing table column header names</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64784#M43951</link>
      <description>&lt;P&gt;I have a result set that I want to display in a table, but customize the header names. My search uses append to get 2 sets of values, and then merges them using stats&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search ...  | stats dc(VisitorID) as "visitors" by Ranges | append [ 
  search ... | stats dc(VisitorID) as "VisitorsWhoX" by Ranges 
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Gives:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Ranges     visitors      VisitorsWhoX
0-10       11  
11-20      19
21-30      7
0-10                      6
11-20                     9
21-30                     2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From this point, I want to do 3 things: Merge the 2 searches by range, calc a 3rd column and rename the column headers. So I do the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats last(visitors) as visitors last(VisitorsWhoX) as VisitorsWhoX by Ranges 
| eval "Conversion Rate"=round(VisitorsWhoX / visitors * 100)."%"
| eval "# of Visitors"=visitors | eval "Visitors who X"=VisitorsWhoX | table Ranges "# of Visitors" "Visitors who X" Ranges
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using this method does give me the results I work, just wondering if it can be optimized:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Is there a better way to merge the results from 2 searches rather than using &lt;CODE&gt;stats&lt;/CODE&gt; in the first line above?&lt;/LI&gt;
&lt;LI&gt;Is there a better way to rename column headers and display them? This report could expand to having up to 10 columns, and having 10  &lt;CODE&gt;| eval "New Field"=oldfield"&lt;/CODE&gt; commands seems very inefficient.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 19 Sep 2012 11:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64784#M43951</guid>
      <dc:creator>brettcave</dc:creator>
      <dc:date>2012-09-19T11:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Changing table column header names</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64785#M43952</link>
      <description>&lt;OL&gt;
&lt;LI&gt;So you still want to the do the first method if possible but have the results in-line... how about the &lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.4/SearchReference/Appendcols"&gt;&lt;CODE&gt;appendcols&lt;/CODE&gt;&lt;/A&gt; to add the fields to your main search and then include them in the table that way?&lt;/LI&gt;
&lt;LI&gt;Instead of using mulitple eval commands, why don't you use &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rename"&gt;&lt;CODE&gt;rename&lt;/CODE&gt;&lt;/A&gt;? Then you could do something like (for example):&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;CODE&gt;..|rename visitors as "# of Visitors", VisitorsWhoX as "Visitors who X" |..&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2012 13:12:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64785#M43952</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-09-19T13:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Changing table column header names</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64786#M43953</link>
      <description>&lt;P&gt;appendcols doesn't work because there isn't a 1 to 1 mapping of columns. in the example above, "VisitorsWhoX" may be null for 0-10 (I could set to 0 if isnull though). &lt;BR /&gt;
 rename: perfect. thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2012 14:47:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64786#M43953</guid>
      <dc:creator>brettcave</dc:creator>
      <dc:date>2012-09-19T14:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Changing table column header names</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64787#M43954</link>
      <description>&lt;P&gt;excellent. worked for me&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 16:55:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Changing-table-column-header-names/m-p/64787#M43954</guid>
      <dc:creator>kjamsheed</dc:creator>
      <dc:date>2015-11-09T16:55:43Z</dc:date>
    </item>
  </channel>
</rss>

