<?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 dropdown case to populate token in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/dropdown-case-to-populate-token/m-p/385185#M112482</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a dropdown with 5 values. &lt;BR /&gt;
But in the following panel query the table and index which i am using has no reference to that above dropdown values. &lt;BR /&gt;
So i have used makeresults  to populate the token and use it in the query &lt;/P&gt;

&lt;P&gt;Now how can i say if from dropdown A is choosen then taken token1 and if from dropwn B is choosen then use token2 &lt;/P&gt;

&lt;P&gt;I tried with a if and eval but thats not working can you may be help with the if condition here so that i can use the same token but gets populated accordingly or use a case statement&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;abc&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|makeresults |eval cfd_hosts=if($infraname$="FRA-CLOUD GTS","SC2CLK-CLOUD-CFD-VDC2 OR host=SC2BJV-CLOUD-CFD-VDC2 OR host=DC2A4-CLOUD-CFD-VDC2",1 )| fields cfd_hosts
     &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="tokField1"&amp;gt;$result.cfd_hosts$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|makeresults |eval fra_bip_hosts="TIGR7-BIP-CFD-A2 OR host=TIGR4-BIP-CFD-A1 OR host=SC2CLK-SVC-CFD-A OR host=SC2ASV-SVC-CFD-A1" | fields fra_bip_hosts
     &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="tokField2"&amp;gt;$result.fra_bip_hosts$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="infraname" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;Infrastructure Name&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;Infrastructure Name&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;|inputlookup temp_infraname.csv | table "Infrastructure Name"&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&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;title&amp;gt;$infraname$ choosen&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| mstats max(_value) as Bits_in_sec where index=ehealth (host=$tokField2$) AND metric_name="*in"   
    by host,metric_name, info span=1d &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&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>Thu, 23 May 2019 01:41:33 GMT</pubDate>
    <dc:creator>surekhasplunk</dc:creator>
    <dc:date>2019-05-23T01:41:33Z</dc:date>
    <item>
      <title>dropdown case to populate token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/dropdown-case-to-populate-token/m-p/385185#M112482</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a dropdown with 5 values. &lt;BR /&gt;
But in the following panel query the table and index which i am using has no reference to that above dropdown values. &lt;BR /&gt;
So i have used makeresults  to populate the token and use it in the query &lt;/P&gt;

&lt;P&gt;Now how can i say if from dropdown A is choosen then taken token1 and if from dropwn B is choosen then use token2 &lt;/P&gt;

&lt;P&gt;I tried with a if and eval but thats not working can you may be help with the if condition here so that i can use the same token but gets populated accordingly or use a case statement&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;abc&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|makeresults |eval cfd_hosts=if($infraname$="FRA-CLOUD GTS","SC2CLK-CLOUD-CFD-VDC2 OR host=SC2BJV-CLOUD-CFD-VDC2 OR host=DC2A4-CLOUD-CFD-VDC2",1 )| fields cfd_hosts
     &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="tokField1"&amp;gt;$result.cfd_hosts$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|makeresults |eval fra_bip_hosts="TIGR7-BIP-CFD-A2 OR host=TIGR4-BIP-CFD-A1 OR host=SC2CLK-SVC-CFD-A OR host=SC2ASV-SVC-CFD-A1" | fields fra_bip_hosts
     &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="tokField2"&amp;gt;$result.fra_bip_hosts$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="infraname" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;Infrastructure Name&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;Infrastructure Name&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;|inputlookup temp_infraname.csv | table "Infrastructure Name"&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&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;title&amp;gt;$infraname$ choosen&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| mstats max(_value) as Bits_in_sec where index=ehealth (host=$tokField2$) AND metric_name="*in"   
    by host,metric_name, info span=1d &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&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>Thu, 23 May 2019 01:41:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/dropdown-case-to-populate-token/m-p/385185#M112482</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2019-05-23T01:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown case to populate token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/dropdown-case-to-populate-token/m-p/385186#M112483</link>
      <description>&lt;P&gt;Hi @surekhasplunk,&lt;/P&gt;

&lt;P&gt;Seems like you're looking for conditional token behavior, have a look at the official documentation here there's a good example on how to use it : &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/Viz/ContextualDrilldown#Configure_conditional_behavior"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/Viz/ContextualDrilldown#Configure_conditional_behavior&lt;/A&gt;&lt;BR /&gt;
And here :&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/Viz/tokens#Conditional_operations_with_form_inputs"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/Viz/tokens#Conditional_operations_with_form_inputs&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You can use on &lt;CODE&gt;change&lt;/CODE&gt; for each of your inputs so whenever one changes your token is set, so for the first input you would have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;change&amp;gt;
      &amp;lt;set token="yourtoken"&amp;gt;$token1$&amp;lt;/set&amp;gt;
  &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the second as well but with token2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;change&amp;gt;
      &amp;lt;set token="yourtoken"&amp;gt;$token2$&amp;lt;/set&amp;gt;
  &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 06:21:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/dropdown-case-to-populate-token/m-p/385186#M112483</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-23T06:21:29Z</dc:date>
    </item>
  </channel>
</rss>

