<?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 Format or Splitup a row of data ito three rows for reporting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113449#M29840</link>
    <description>&lt;P&gt;I am doing a search from two databases and comparing data from both.  I am using the appenccols command to get the data from both databases in one row so that I can do math on the data like this.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[| dbquery "db1" "SELECT" | join type left [dbquery "db2" "SELECT"]| fields db1_count notindb2 |  appenccols [| dbquery "db2" "SELECT" | join type left [dbquery "db1" "SELECT"]| fields db2_count notindb1 | &lt;BR /&gt;
| eval db1_total=db1_count + notindb1 &lt;BR /&gt;
| eval db2_total=db2_count + notindb2&lt;BR /&gt;
| eval confidence=tostring(round(db1_total/db2_total*100,2))."%"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;this gives me a table &lt;BR /&gt;
&lt;CODE&gt;db1_count     notindb1     db2count     notinbd2     db1_total     db2_total     confidence&lt;BR /&gt;
       126         126          236           15            252          251       99.60%&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I would like to split up the one row to look like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
database_name     count     notindb         total&lt;BR /&gt;
db1                 126         126           252&lt;BR /&gt;
db2                 236          15           251&lt;BR /&gt;
confidence    99.60%&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any suggestions would be appreciated&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jul 2015 19:51:35 GMT</pubDate>
    <dc:creator>hartfoml</dc:creator>
    <dc:date>2015-07-10T19:51:35Z</dc:date>
    <item>
      <title>Format or Splitup a row of data ito three rows for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113449#M29840</link>
      <description>&lt;P&gt;I am doing a search from two databases and comparing data from both.  I am using the appenccols command to get the data from both databases in one row so that I can do math on the data like this.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[| dbquery "db1" "SELECT" | join type left [dbquery "db2" "SELECT"]| fields db1_count notindb2 |  appenccols [| dbquery "db2" "SELECT" | join type left [dbquery "db1" "SELECT"]| fields db2_count notindb1 | &lt;BR /&gt;
| eval db1_total=db1_count + notindb1 &lt;BR /&gt;
| eval db2_total=db2_count + notindb2&lt;BR /&gt;
| eval confidence=tostring(round(db1_total/db2_total*100,2))."%"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;this gives me a table &lt;BR /&gt;
&lt;CODE&gt;db1_count     notindb1     db2count     notinbd2     db1_total     db2_total     confidence&lt;BR /&gt;
       126         126          236           15            252          251       99.60%&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I would like to split up the one row to look like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
database_name     count     notindb         total&lt;BR /&gt;
db1                 126         126           252&lt;BR /&gt;
db2                 236          15           251&lt;BR /&gt;
confidence    99.60%&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any suggestions would be appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 19:51:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113449#M29840</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2015-07-10T19:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Format or Splitup a row of data ito three rows for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113450#M29841</link>
      <description>&lt;P&gt;If you specify what field are coming out of each table (even better would be a sample row from each table) and if there is one field you would like to use to &lt;CODE&gt;join&lt;/CODE&gt;, I will try to help.  As it is, I do not understand how you are trying to merge.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2015 00:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113450#M29841</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-11T00:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Format or Splitup a row of data ito three rows for reporting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113451#M29842</link>
      <description>&lt;P&gt;I'm answering based on what you've shown us. But the question says :"Format or Splitup a row of data into three rows for reporting" however your example shows the resulting row and a single row of what you'd like it to look like... &lt;/P&gt;

&lt;P&gt;if that's not what you meant to show, please add details to your question. (do not add a comment with detail,  edit the question)&lt;/P&gt;

&lt;P&gt;That said...&lt;/P&gt;

&lt;P&gt;What you're producing here is a "dataset" that you can then continue to manipulate. the fact that it's coming from the db queries and the join is really irrelevant. &lt;/P&gt;

&lt;P&gt;From your example, it looks like you want to continue your search with a pipe and merge the notindbX fields  and the dbX_count fields while re-ordering the others. (you don't seem to have the database_name field so you will have to add that to the initial search)&lt;BR /&gt;
 Why would you not just merge the fields (From your example, it looks like you want to continue your search with a pipe and merge the notindbX fields  and the dbX_count fields while re-ordering the others. (you don't seem to have the database_name field. Why would you not just merge the fields ([&lt;A href="https://answers.splunk.com/answers/49394/merge-two-fields-into-one-field.html%5D%5B1%5D" target="_blank"&gt;https://answers.splunk.com/answers/49394/merge-two-fields-into-one-field.html][1]&lt;/A&gt;) &lt;BR /&gt;
and then continue with |table .... &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Format-or-Splitup-a-row-of-data-ito-three-rows-for-reporting/m-p/113451#M29842</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2020-09-29T06:39:45Z</dc:date>
    </item>
  </channel>
</rss>

