<?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: using output from a query as  the query for another query in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472084#M58025</link>
    <description>&lt;P&gt;Many thanks for a speedy reply&lt;BR /&gt;
This is the code&lt;BR /&gt;
index="foo" Name="bar"  NOT delta="epsilon*" Number !=""&lt;BR /&gt;
|stats values(Number) as number by Date Description &lt;BR /&gt;
|sort  Date&lt;BR /&gt;
|lookup data Date OUTPUT colour as hue&lt;BR /&gt;
|eval niche=",".Description."=".number&lt;BR /&gt;
|stats values(hue) as hue values(niche) as niche by Date &lt;BR /&gt;
| nomv niche&lt;BR /&gt;
|eval base= "| append[| makeresults |eval key=\"".Date."\" ".niche."| untable key,\"axis\",\"value\" | eval keyColor=\"".hue."\"]"&lt;BR /&gt;
|stats values(base) as base&lt;BR /&gt;
|mvcombine delim=" " base &lt;BR /&gt;
|nomv base&lt;BR /&gt;
|stats values(base)&lt;/P&gt;

&lt;P&gt;If there were three time periods it produces this output which is needed for the visualization - now need to turn the output into it's own query...&lt;BR /&gt;
&lt;STRONG&gt;base&lt;/STRONG&gt;&lt;BR /&gt;
| append[| makeresults |eval key="201705" ,variable1=0 ,variable2=1 ,variable3=2 ,variable4=5 | untable key,"axis","value" | eval keyColor="magenta"] | append[| makeresults |eval key="201805" ,variable1=3 ,variable2=5 ,variable3=1 ,variable4=3 | untable key,"axis","value" | eval keyColor="blue"] | append[| makeresults |eval key="201905" ,variable1=2 ,variable2=2 ,variable3=1 ,variable4=1 | untable key,"axis","value" | eval keyColor="green"]&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2019 09:57:22 GMT</pubDate>
    <dc:creator>ChrisCLewis</dc:creator>
    <dc:date>2019-09-05T09:57:22Z</dc:date>
    <item>
      <title>using output from a query as  the query for another query</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472082#M58023</link>
      <description>&lt;P&gt;I am using the Custom Radar  add on visualization.  It requires using |makeresults to generate the data needed to create the graph.&lt;BR /&gt;
I have worked out how to run a query that produces the |makeresults needed but I can't work out how to use that output as the query for a search.&lt;/P&gt;

&lt;P&gt;Is this something people have looked at (not just for the add on).&lt;/P&gt;

&lt;P&gt;Many thanks &lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 09:30:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472082#M58023</guid>
      <dc:creator>ChrisCLewis</dc:creator>
      <dc:date>2019-09-05T09:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: using output from a query as  the query for another query</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472083#M58024</link>
      <description>&lt;P&gt;can you post the SPL you have so far?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 09:45:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472083#M58024</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2019-09-05T09:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: using output from a query as  the query for another query</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472084#M58025</link>
      <description>&lt;P&gt;Many thanks for a speedy reply&lt;BR /&gt;
This is the code&lt;BR /&gt;
index="foo" Name="bar"  NOT delta="epsilon*" Number !=""&lt;BR /&gt;
|stats values(Number) as number by Date Description &lt;BR /&gt;
|sort  Date&lt;BR /&gt;
|lookup data Date OUTPUT colour as hue&lt;BR /&gt;
|eval niche=",".Description."=".number&lt;BR /&gt;
|stats values(hue) as hue values(niche) as niche by Date &lt;BR /&gt;
| nomv niche&lt;BR /&gt;
|eval base= "| append[| makeresults |eval key=\"".Date."\" ".niche."| untable key,\"axis\",\"value\" | eval keyColor=\"".hue."\"]"&lt;BR /&gt;
|stats values(base) as base&lt;BR /&gt;
|mvcombine delim=" " base &lt;BR /&gt;
|nomv base&lt;BR /&gt;
|stats values(base)&lt;/P&gt;

&lt;P&gt;If there were three time periods it produces this output which is needed for the visualization - now need to turn the output into it's own query...&lt;BR /&gt;
&lt;STRONG&gt;base&lt;/STRONG&gt;&lt;BR /&gt;
| append[| makeresults |eval key="201705" ,variable1=0 ,variable2=1 ,variable3=2 ,variable4=5 | untable key,"axis","value" | eval keyColor="magenta"] | append[| makeresults |eval key="201805" ,variable1=3 ,variable2=5 ,variable3=1 ,variable4=3 | untable key,"axis","value" | eval keyColor="blue"] | append[| makeresults |eval key="201905" ,variable1=2 ,variable2=2 ,variable3=1 ,variable4=1 | untable key,"axis","value" | eval keyColor="green"]&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 09:57:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472084#M58025</guid>
      <dc:creator>ChrisCLewis</dc:creator>
      <dc:date>2019-09-05T09:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: using output from a query as  the query for another query</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472085#M58026</link>
      <description>&lt;P&gt;Many thanks for the speedy reply, the SPL is:&lt;/P&gt;

&lt;P&gt;index="foo" Name="bar"  NOT delta="epsilon*" Number !=""&lt;BR /&gt;
|stats values(Number) as number by Date Description &lt;BR /&gt;
|sort  Date&lt;BR /&gt;
|lookup data Date OUTPUT colour as hue&lt;BR /&gt;
|eval niche=",".Description."=".number&lt;BR /&gt;
|stats values(hue) as hue values(niche) as niche by Date &lt;BR /&gt;
| nomv niche&lt;BR /&gt;
|eval base= "| append[| makeresults |eval key=\"".Date."\" ".niche."| untable key,\"axis\",\"value\" | eval keyColor=\"".hue."\"]"&lt;BR /&gt;
|stats values(base) as base&lt;BR /&gt;
|mvcombine delim=" " base &lt;BR /&gt;
|nomv base&lt;BR /&gt;
|stats values(base)&lt;/P&gt;

&lt;P&gt;This is the output from the SPL which is a search that the add on would accept&lt;BR /&gt;
| append[| makeresults |eval key="201705" ,variable1=0 ,variable2=1 ,variable3=2 ,variable4=5 | untable key,"axis","value" | eval keyColor="magenta"] | append[| makeresults |eval key="201805" ,variable1=3 ,variable2=5 ,variable3=1 ,variable4=3 | untable key,"axis","value" | eval keyColor="blue"] | append[| makeresults |eval key="201905" ,variable1=2 ,variable2=2 ,variable3=1 ,variable4=1 | untable key,"axis","value" | eval keyColor="green"]&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 10:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472085#M58026</guid>
      <dc:creator>ChrisCLewis</dc:creator>
      <dc:date>2019-09-05T10:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: using output from a query as  the query for another query</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472086#M58027</link>
      <description>&lt;P&gt;I have found the solution:&lt;/P&gt;

&lt;P&gt;You assign the output with a token using the following:&lt;/P&gt;

&lt;P&gt;set token="field_token"&amp;gt;$result.base$&lt;/P&gt;

&lt;P&gt;Then in another panel you use the following query&lt;BR /&gt;
|loadjob $field_token$&lt;/P&gt;

&lt;P&gt;result.base only takes the first value for the field which is fine as all the results have been combined. I found it when looking into tokens and id's for searches (&lt;A href="https://answers.splunk.com/answers/660087/why-is-the-token-resultfield-not-populating-as-def.html"&gt;https://answers.splunk.com/answers/660087/why-is-the-token-resultfield-not-populating-as-def.html&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 15:07:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/using-output-from-a-query-as-the-query-for-another-query/m-p/472086#M58027</guid>
      <dc:creator>ChrisCLewis</dc:creator>
      <dc:date>2019-09-05T15:07:30Z</dc:date>
    </item>
  </channel>
</rss>

