<?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: Is it possible to produce a dynamic search using token generated fields? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206995#M12983</link>
    <description>&lt;P&gt;Did you try like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=fruit_store | list avg("roomTemp$fruit$_qty" ), avg("chilled_$fruit$_qty")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=fruit_store | eval roomTempFieldName = [| gentimes start=-1 | eval search="roomTemp" + $fruit$ + "_qty" | table search] | eval  chilledFieldName = [| gentimes start=-1 | eval search="chilled_" $fruit$ + "_qty" | table search] | list avg(roomTempFieldName), avg(chilledFieldName)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 26 Dec 2016 20:21:18 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-12-26T20:21:18Z</dc:date>
    <item>
      <title>Is it possible to produce a dynamic search using token generated fields?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206993#M12981</link>
      <description>&lt;P&gt;Hi there, is it possible to search using fields generated by token?&lt;/P&gt;

&lt;P&gt;For example, I have a couple of fields:&lt;BR /&gt;
1. roomtemp_apple_qty&lt;BR /&gt;
2. chilled_apple_qty&lt;BR /&gt;
3. roomtemp_orange_qty&lt;BR /&gt;
4. chilled_orange_qty&lt;/P&gt;

&lt;P&gt;I wish to be able to pass a $fruit$ token from my drop-down input in a dashboard and do something like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=fruit_store | eval roomTempFieldName = "roomTemp" + $fruit$ + "_qty" | eval  chilledFieldName = "chilled_" $fruit$ + "_qty"| list avg(roomTempFieldName), avg(chilledFieldName)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206993#M12981</guid>
      <dc:creator>ryantodd</dc:creator>
      <dc:date>2020-09-29T12:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to produce a dynamic search using token generated fields?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206994#M12982</link>
      <description>&lt;P&gt;You can probably do what you ask in some way using the $value$ token in a dropdown (see &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Access_labels_and_values_of_form_inputs"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Access_labels_and_values_of_form_inputs&lt;/A&gt;), but it may be more trouble than its worth. Instead, you can use the &lt;CODE&gt;conditional&lt;/CODE&gt; elements to do it like the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="fruittype"&amp;gt;
      &amp;lt;label&amp;gt;Select a fruit type&amp;lt;/label&amp;gt;
      &amp;lt;choice value="apple"&amp;gt;Apples&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="orange"&amp;gt;Oranges&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition label="Apples"&amp;gt;
          &amp;lt;set token="roomtemp_field"&amp;gt;roomtemp_apple_qty&amp;lt;/set&amp;gt;
          &amp;lt;set token="chilledtemp_field"&amp;gt;chilled_apple_qty&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition label="Oranges"&amp;gt;
          &amp;lt;set token="roomtemp_field"&amp;gt;roomtemp_orange_qty&amp;lt;/set&amp;gt;
          &amp;lt;set token="chilledtemp_field"&amp;gt;chilled_orange_qty&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;sourcetype=fruit_store | stats avg($roomtemp_field$) avg($chilledtemp_field$)&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Dec 2016 16:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206994#M12982</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-12-26T16:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to produce a dynamic search using token generated fields?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206995#M12983</link>
      <description>&lt;P&gt;Did you try like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=fruit_store | list avg("roomTemp$fruit$_qty" ), avg("chilled_$fruit$_qty")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=fruit_store | eval roomTempFieldName = [| gentimes start=-1 | eval search="roomTemp" + $fruit$ + "_qty" | table search] | eval  chilledFieldName = [| gentimes start=-1 | eval search="chilled_" $fruit$ + "_qty" | table search] | list avg(roomTempFieldName), avg(chilledFieldName)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Dec 2016 20:21:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-produce-a-dynamic-search-using-token-generated/m-p/206995#M12983</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-26T20:21:18Z</dc:date>
    </item>
  </channel>
</rss>

