<?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 How to create a dynamic radio button input that is populated with options based on the selection of another radio button? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258194#M16220</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I would like to add another drilldown/radio button depending on another radio button.&lt;BR /&gt;
The idea is to make the content change on this second radio button, depending on what has been selected on the first one!&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="multi radio button"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1379i085E18C4AC8DD947/image-size/large?v=v2&amp;amp;px=999" role="button" title="multi radio button" alt="multi radio button" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;If I select component, I want to be able to select between: Component1, Component2, Component3, ...&lt;BR /&gt;
same for typeEvent : typeEvent1, typeEvent2, ...&lt;BR /&gt;
and same for host&lt;/P&gt;

&lt;P&gt;Thanks you for your help!&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2016 09:12:31 GMT</pubDate>
    <dc:creator>BaptVe</dc:creator>
    <dc:date>2016-05-19T09:12:31Z</dc:date>
    <item>
      <title>How to create a dynamic radio button input that is populated with options based on the selection of another radio button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258194#M16220</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I would like to add another drilldown/radio button depending on another radio button.&lt;BR /&gt;
The idea is to make the content change on this second radio button, depending on what has been selected on the first one!&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="multi radio button"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1379i085E18C4AC8DD947/image-size/large?v=v2&amp;amp;px=999" role="button" title="multi radio button" alt="multi radio button" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;If I select component, I want to be able to select between: Component1, Component2, Component3, ...&lt;BR /&gt;
same for typeEvent : typeEvent1, typeEvent2, ...&lt;BR /&gt;
and same for host&lt;/P&gt;

&lt;P&gt;Thanks you for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 09:12:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258194#M16220</guid>
      <dc:creator>BaptVe</dc:creator>
      <dc:date>2016-05-19T09:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic radio button input that is populated with options based on the selection of another radio button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258195#M16221</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens"&gt;Tokens&lt;/A&gt; work inside field selectors. I generally like to limit all my selectors by the time range selected so the options are relevant. You should be able to dynamically populate your selection list using a search with tokens from the other selector.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 00:41:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258195#M16221</guid>
      <dc:creator>dolivasoh</dc:creator>
      <dc:date>2016-05-20T00:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic radio button input that is populated with options based on the selection of another radio button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258196#M16222</link>
      <description>&lt;P&gt;You can add a new Dropdown control which runs Splunk search query to populate Dynamic Options. Following is a near example of your problem:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 1&lt;/STRONG&gt;: Define a Time input (only way to define earliest and latest timestamps in Downdown control's "&lt;STRONG&gt;Dynamic Options&lt;/STRONG&gt;" is through Time control's &lt;STRONG&gt;earliest and latest tokens&lt;/STRONG&gt;. Used in Step 3c below.) : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="time" token="selTime" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;Select Time&amp;lt;/label&amp;gt;
  &amp;lt;default&amp;gt;
    &amp;lt;earliest&amp;gt;-6h@h&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
  &amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Step 2&lt;/STRONG&gt; : Add Radio control with Event Selectors (in this case &lt;STRONG&gt;App Name&lt;/STRONG&gt;, &lt;STRONG&gt;Component&lt;/STRONG&gt; and &lt;STRONG&gt;Host&lt;/STRONG&gt;, with Host being default selection). Since I have picked _internal index for my example field values are app, component and host respectively :  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="radio" token="selEvent" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;Event Selectors&amp;lt;/label&amp;gt;
  &amp;lt;choice value="app"&amp;gt;App Name&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="component"&amp;gt;Component&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="host"&amp;gt;Host&amp;lt;/choice&amp;gt;
  &amp;lt;default&amp;gt;host&amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Step 3&lt;/STRONG&gt;: Define your Event Detail dropown. I have added default as &lt;STRONG&gt;Static Options&lt;/STRONG&gt; i.e. &lt;STRONG&gt;Name= All&lt;/STRONG&gt; and &lt;STRONG&gt;Value="*"&lt;/STRONG&gt;. Which should select something like &lt;STRONG&gt;host=*&lt;/STRONG&gt; in our case as default search on loading dashboard. For the Dynamic Option I have taken the following steps:&lt;BR /&gt;
     &lt;STRONG&gt;3 a)&lt;/STRONG&gt; All fields for radio button must be present in the events being searched. So, add &lt;STRONG&gt;fieldname=*&lt;/STRONG&gt; conditions to main search filter query (before first pipe). In our case &lt;STRONG&gt;app=* component=* host=*&lt;/STRONG&gt;. Search performance tip is to eliminate unwanted events upfront rather than later. NULL values might show up in this particular example, if field is not present in event being searched. &lt;BR /&gt;
     &lt;STRONG&gt;3 b)&lt;/STRONG&gt; Similar to above the final field being plotted in the timechart should also be present in the events. In our case &lt;STRONG&gt;status=*&lt;/STRONG&gt;&lt;BR /&gt;
     &lt;STRONG&gt;3 c)&lt;/STRONG&gt; Since unique values for selected event types is required only for specified time range, use Time control to define earliest and latest time for Dynamic query. In our case &lt;STRONG&gt;$selTime.earliest$&lt;/STRONG&gt; and &lt;STRONG&gt;$selTime.latest$&lt;/STRONG&gt;.&lt;BR /&gt;
     &lt;STRONG&gt;3 d)&lt;/STRONG&gt; Store selected event type as a new field using &lt;STRONG&gt;eval&lt;/STRONG&gt; (to be used as Dropdown field's dynamic Value and Name later in step 3f ). In our case &lt;STRONG&gt;eval selDetail=$selEvent$&lt;/STRONG&gt;&lt;BR /&gt;
     &lt;STRONG&gt;3 e)&lt;/STRONG&gt; Use a combination of &lt;STRONG&gt;dedup&lt;/STRONG&gt; (to get unique values of selected event type), &lt;STRONG&gt;sort&lt;/STRONG&gt; and &lt;STRONG&gt;table&lt;/STRONG&gt; to populate Event Type Name for selected event type. &lt;STRONG&gt;Alternatively&lt;/STRONG&gt;, &lt;STRONG&gt;lookup&lt;/STRONG&gt; table may be used (if possible), instead of dedup as dedup may prove to be slow running command sometimes.&lt;BR /&gt;
     &lt;STRONG&gt;3 f)&lt;/STRONG&gt;  Apply event detail printed using table command set the &lt;STRONG&gt;fieldForValue&lt;/STRONG&gt; and &lt;STRONG&gt;fieldForLabel&lt;/STRONG&gt; attributes for Dynamic Options for the Dropdown. In our case &lt;STRONG&gt;selDetail&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="dropdown" token="selDetail" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;Detailed Selector&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index="_internal" component=* app=* host=* status=* earliest=$selTime.earliest$ latest=$selTime.latest$ | eval selDetail=$selEvent$ | dedup selDetail | sort selDetail | table selDetail&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
  &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;selDetail&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;selDetail&amp;lt;/fieldForValue&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Step 4&lt;/STRONG&gt;: In the dashboard panel search command where timechart is to be displayed, use the Event Type Radio input token and Event Detail Dropdown input dynamic token to add to the main filter search criteria. In our case &lt;STRONG&gt;$selEvent$=$selDetail$&lt;/STRONG&gt;. Following is the code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;index="_internal" eventtype=* app=* host=* status=*  $selEvent$=$selDetail$ | timechart count by status span=5min limit=20&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;$selTime.earliest$&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;$selTime.latest$&amp;lt;/latest&amp;gt;
    &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1378i556F6F3446299FD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2016 20:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258196#M16222</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-10-30T20:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic radio button input that is populated with options based on the selection of another radio button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258197#M16223</link>
      <description>&lt;P&gt;You need to have two radio button inputs as below:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;First radio input called "First Selection" populates itself using the "query1". From the query output, the field "myField1" is set as the options of radio input as a table; and whatever value of "myField1" user selects gets saved in the token "myToken1" &lt;/P&gt;

&lt;P&gt;&lt;FIELDSET submitbutton="false"&gt;&lt;BR /&gt;
        &lt;INPUT type="radio" token="myToken1" searchwhenchanged="true" /&gt;&lt;BR /&gt;
          &lt;LABEL&gt;First selection&lt;/LABEL&gt;&lt;BR /&gt;
          &lt;SEARCH&gt;&lt;BR /&gt;
            &lt;QUERY&gt;query1 that will populate the fields of first radio button | table myField1&lt;/QUERY&gt;&lt;BR /&gt;
          &lt;/SEARCH&gt;&lt;BR /&gt;
          &lt;FIELDFORLABEL&gt;myField1&lt;/FIELDFORLABEL&gt;&lt;BR /&gt;
          &lt;FIELDFORVALUE&gt;myField1&lt;/FIELDFORVALUE&gt;&lt;BR /&gt;
        &lt;/FIELDSET&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Second radio input called "Second Selection" populates itself using the "query2" which uses "myToken1" value. From the query output, the field "myField2" is set as the options of radio input as a table; and whatever value of "myField2" user selects gets saved in the token "myToken2" &lt;/P&gt;

&lt;P&gt;&lt;INPUT type="radio" token="myToekn2" searchwhenchanged="true" /&gt;&lt;BR /&gt;
          &lt;LABEL&gt;Second selection&lt;/LABEL&gt;&lt;BR /&gt;
          &lt;SEARCH&gt;&lt;BR /&gt;
            &lt;QUERY&gt;query2 making use of $myToken1$ to populate fields of second radio button| table myField2&lt;/QUERY&gt;&lt;BR /&gt;
          &lt;/SEARCH&gt;&lt;BR /&gt;
          &lt;FIELDFORLABEL&gt;myField2&lt;/FIELDFORLABEL&gt;&lt;BR /&gt;
          &lt;FIELDFORVALUE&gt;myField2&lt;/FIELDFORVALUE&gt;&lt;BR /&gt;
        &lt;BR /&gt;
      &lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Pay attention to &lt;CODE&gt;searchWhenChanged="true"&lt;/CODE&gt; and the opening and closing of the &lt;CODE&gt;fieldset&lt;/CODE&gt; tag.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 00:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-radio-button-input-that-is-populated/m-p/258197#M16223</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-10-31T00:43:52Z</dc:date>
    </item>
  </channel>
</rss>

