<?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: Conditional if based on dropdown value (match with a column name for second dropdown) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243731#M72547</link>
    <description>&lt;P&gt;This is bit confusing (the drilldown on input, I don't think you need that), but give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;panel&amp;gt;

  &amp;lt;input type="dropdown" token="unit_type" searchWhenChange="true"&amp;gt;
   &amp;lt;label&amp;gt;Select a traffic unit type&amp;lt;/label&amp;gt;
   &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
   &amp;lt;choice value="T1"&amp;gt;T1&amp;lt;/choice&amp;gt;
   &amp;lt;choice value="T2"&amp;gt;T2&amp;lt;/choice&amp;gt;
   &amp;lt;choice value="T3"&amp;gt;T3&amp;lt;/choice&amp;gt;     
  &amp;lt;/input&amp;gt;

   &amp;lt;input type="dropdown" token="traffic_unit_number" searchWhenChange="true"&amp;gt;
   &amp;lt;label&amp;gt;Traffic Unit Number: &amp;lt;/label&amp;gt;
   &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
     &amp;lt;populatingSearch fieldForValue="unit_number" fieldForLabel="unit_number"&amp;gt;
       &amp;lt;![CDATA[index=main source=traffic_locations sourcetype=TRAFFIC_DATA 
               | eval new_val = $unit_type$
               | eval t1 =  if(unit_type=="T1", T1_sn, "")
               | stats count by t1
               | table t1]]&amp;gt;
     &amp;lt;/populatingSearch&amp;gt;
   &amp;lt;/input&amp;gt;
   &amp;lt;row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 12 May 2016 15:00:22 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-05-12T15:00:22Z</dc:date>
    <item>
      <title>Conditional if based on dropdown value (match with a column name for second dropdown)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243730#M72546</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;  I have two dropdowns, first one selects T1, T2 or T3. 
  Depending on the first selection the second dropdown will
  match this information with a column name (i.e. T1_sn) in 
  and display all the values under this column in the dropdown.

  First one works fine with choice, I think for the second 
  dropdown which is based on the drilldown value of the 
  first dropdown I cannot do the comparison using the 
  conditional if statement properly.

  Please help.



 &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;

     &amp;lt;input type="dropdown" token="unit_type" searchWhenChange="true"&amp;gt;
      &amp;lt;label&amp;gt;Select a traffic unit type&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
      &amp;lt;choice value="T1"&amp;gt;T1&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="T2"&amp;gt;T2&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="T3"&amp;gt;T3&amp;lt;/choice&amp;gt;

      &amp;lt;option name="count"&amp;gt;300&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;set token="get_site_code"&amp;gt;$click.value$&amp;lt;/set&amp;gt;
        &amp;lt;/drilldown&amp;gt;
     &amp;lt;/input&amp;gt;

      &amp;lt;input type="dropdown" token="traffic_unit_number" searchWhenChange="true"&amp;gt;
      &amp;lt;label&amp;gt;Traffic Unit Number: &amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
        &amp;lt;populatingSearch fieldForValue="unit_number" fieldForLabel="unit_number"&amp;gt;
          &amp;lt;![CDATA[index=main source=traffic_locations sourcetype=TRAFFIC_DATA 
                  | eval new_val = $unit_type$
                  | eval t1 =  if(new_val=="T1", T1_sn, "")
                  | stats count by t1
                  | table t1]]&amp;gt;
        &amp;lt;/populatingSearch&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 May 2016 14:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243730#M72546</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2016-05-12T14:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional if based on dropdown value (match with a column name for second dropdown)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243731#M72547</link>
      <description>&lt;P&gt;This is bit confusing (the drilldown on input, I don't think you need that), but give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;panel&amp;gt;

  &amp;lt;input type="dropdown" token="unit_type" searchWhenChange="true"&amp;gt;
   &amp;lt;label&amp;gt;Select a traffic unit type&amp;lt;/label&amp;gt;
   &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
   &amp;lt;choice value="T1"&amp;gt;T1&amp;lt;/choice&amp;gt;
   &amp;lt;choice value="T2"&amp;gt;T2&amp;lt;/choice&amp;gt;
   &amp;lt;choice value="T3"&amp;gt;T3&amp;lt;/choice&amp;gt;     
  &amp;lt;/input&amp;gt;

   &amp;lt;input type="dropdown" token="traffic_unit_number" searchWhenChange="true"&amp;gt;
   &amp;lt;label&amp;gt;Traffic Unit Number: &amp;lt;/label&amp;gt;
   &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
     &amp;lt;populatingSearch fieldForValue="unit_number" fieldForLabel="unit_number"&amp;gt;
       &amp;lt;![CDATA[index=main source=traffic_locations sourcetype=TRAFFIC_DATA 
               | eval new_val = $unit_type$
               | eval t1 =  if(unit_type=="T1", T1_sn, "")
               | stats count by t1
               | table t1]]&amp;gt;
     &amp;lt;/populatingSearch&amp;gt;
   &amp;lt;/input&amp;gt;
   &amp;lt;row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 May 2016 15:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243731#M72547</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-12T15:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional if based on dropdown value (match with a column name for second dropdown)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243732#M72548</link>
      <description>&lt;P&gt;This doesn't work but line 17&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval t1 =  if(unit_type=="T1", T1_sn, "")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;shouldn't it be &lt;BR /&gt;
    | eval t1 = if(new_val=="T1", T1_sn, "")&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-if-based-on-dropdown-value-match-with-a-column-name/m-p/243732#M72548</guid>
      <dc:creator>smhsplunk</dc:creator>
      <dc:date>2020-09-29T09:40:38Z</dc:date>
    </item>
  </channel>
</rss>

