<?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: dropdown value used in different ways in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614152#M213428</link>
    <description>&lt;P&gt;Thanks for the suggestion! I was able to get it to run successfully using&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;change&amp;gt;
    &amp;lt;eval token="modified_client"&amp;gt;replace($value$, "[.|_]", "-")&amp;lt;/eval&amp;gt;
  &amp;lt;change&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Sep 2022 15:01:58 GMT</pubDate>
    <dc:creator>thenormalone</dc:creator>
    <dc:date>2022-09-22T15:01:58Z</dc:date>
    <item>
      <title>How to use dropdown value in different ways?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/613995#M213365</link>
      <description>&lt;P&gt;I have a dropdown whose value once input needs to be used in two different ways in the same search query. One of the indexes require that value to be as is but the other index requires the value to be altered.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm doing something like what ive mentioned below but that doesn't seem to be working. Any help is appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dropdown token value is selected_client with the initial value being "*"

(index = indexA OR index = indexB) AND (clientForIndexA = domain1 OR clientForIndexB = domain2)
| eval domain1 = if("$selected_client$" == "*", "*", "$selected_client$") 
| eval domain2 = if(domain1 == "*", "*", replace (sync_ml_domain, "\." , "-")) 
| eval domain2 = if(domain1 == "*", "*", replace (sync_ml_domain, "_" , "-"))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 23:20:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/613995#M213365</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2022-09-21T23:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown value used in different ways</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/613998#M213366</link>
      <description>&lt;P&gt;I presume you are trying to replace both the "." and the "_" with a "-" for domain2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, the issue was with the two eval statements for domain2. I was able to make it work (at least for what I think you are trying to achieve) as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval domain1 = "$selected_client$"
| eval domain2 = if(domain1 == "*", "*", replace (sync_ml_domain, "[\.|_]" , "-"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, you will notice that I do not have an IF statement for domain 1, as it appears to be redundant the way it was written. Let me know if this solves your problem!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 21:52:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/613998#M213366</guid>
      <dc:creator>jdunlea</dc:creator>
      <dc:date>2022-09-21T21:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown value used in different ways</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614000#M213368</link>
      <description>&lt;P&gt;I am trying to&amp;nbsp;&lt;SPAN&gt;replace both the "." and the "_" with a "-" for domain2, thanks for the suggestion.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So the default value for $selected_client$ is * which it is being assigned to domain 1 however search doesn't return anything because clientForIndexA still just maps to domain1 in my dashboard panel&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(clientForIndexA = domain1 OR clientForIndexB = host*domain2*prod)
| eval domain1 = "*" 
| eval domain2 = if(domain1 == "*", "*", replace (domain1, "[\.|_]" , "-"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so how do I get the values of domain1 and domain2 to be used in the search query?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 12:51:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614000#M213368</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2022-09-22T12:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown value used in different ways</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614033#M213379</link>
      <description>&lt;P&gt;If I understand correctly, you are trying to match the clientForIndex?? against the selected dropdown where the field has a different format in each index and want to do something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index = indexA clientForIndexA = $selected_client$) OR (index = indexB clientForIndexB = $modified_client$)&lt;/LI-CODE&gt;&lt;P&gt;where selected_client is the chosen value to match against clientForIndexA field from the dropdown and clientForIndexB needs to match against a modified domain format.&lt;/P&gt;&lt;P&gt;In that case, just create a second token in a change block of the input, like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="dropdown" token="selected_client"&amp;gt;
...
  &amp;lt;change&amp;gt;
    &amp;lt;eval token="modified_client"&amp;gt;replace($value$, "[\.|_]", "-")&amp;lt;/eval&amp;gt;
  &amp;lt;change&amp;gt;
&amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;however, I am not sure if I understood your question correctly as you have the sync_ml_domain field&lt;/P&gt;&lt;P&gt;Anyway,&amp;nbsp; you can't do eval statements after the search which can then change the effect of the search like you are doing.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 07:09:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614033#M213379</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-09-22T07:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown value used in different ways</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614152#M213428</link>
      <description>&lt;P&gt;Thanks for the suggestion! I was able to get it to run successfully using&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;change&amp;gt;
    &amp;lt;eval token="modified_client"&amp;gt;replace($value$, "[.|_]", "-")&amp;lt;/eval&amp;gt;
  &amp;lt;change&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 15:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-dropdown-value-in-different-ways/m-p/614152#M213428</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2022-09-22T15:01:58Z</dc:date>
    </item>
  </channel>
</rss>

