<?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 token display name and value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600666#M209088</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246491"&gt;@biju_babu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;It isn't so immediate:&lt;/P&gt;&lt;P&gt;you should separate the label from the value, in other words, you should run in the dropdown&amp;nbsp;&amp;nbsp;a search like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;your_search
| eval both_fields=Display_Name."|".Value
| table Display_Name Value&lt;/LI-CODE&gt;&lt;P&gt;Than you should associate to the label the "Display_Name" field and to the value the "Value" field.&lt;/P&gt;&lt;P&gt;Then in the search you have to separate the two components of "both_fields" using a regex like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=both_fields "^(?&amp;lt;Display_Name&amp;gt;[^\|]*)\|(?&amp;lt;Value&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;in this way you have in your search both Display_Value and Value.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jun 2022 10:51:38 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-06-06T10:51:38Z</dc:date>
    <item>
      <title>Is it possible to get dropdown token display name and value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600663#M209087</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dropdown in my dashboard studio which has some static values like&lt;/P&gt;
&lt;P&gt;TokenName: appName&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;&lt;STRONG&gt;Display Name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="50%"&gt;&lt;STRONG&gt;Value&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;App1&lt;/TD&gt;
&lt;TD&gt;Value1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;App2&lt;/TD&gt;
&lt;TD&gt;Value2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my search query, i need to use both display name and value. We can get the value using $appName$ but is it possible to also get display name?&lt;/P&gt;
&lt;P&gt;Hoping for a help. Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 14:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600663#M209087</guid>
      <dc:creator>biju_babu</dc:creator>
      <dc:date>2022-06-06T14:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown token display name and value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600666#M209088</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/246491"&gt;@biju_babu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;It isn't so immediate:&lt;/P&gt;&lt;P&gt;you should separate the label from the value, in other words, you should run in the dropdown&amp;nbsp;&amp;nbsp;a search like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;your_search
| eval both_fields=Display_Name."|".Value
| table Display_Name Value&lt;/LI-CODE&gt;&lt;P&gt;Than you should associate to the label the "Display_Name" field and to the value the "Value" field.&lt;/P&gt;&lt;P&gt;Then in the search you have to separate the two components of "both_fields" using a regex like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=both_fields "^(?&amp;lt;Display_Name&amp;gt;[^\|]*)\|(?&amp;lt;Value&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;in this way you have in your search both Display_Value and Value.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 10:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600666#M209088</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-06T10:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown token display name and value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600668#M209089</link>
      <description>&lt;P&gt;Actually, i want to set source as display_Name and use value in search&lt;/P&gt;&lt;P&gt;for example -&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=main sourcetype="access_combined" source="&lt;STRONG&gt;App1&lt;/STRONG&gt;" | search "&lt;STRONG&gt;Value1&lt;/STRONG&gt;*"&lt;/P&gt;&lt;P&gt;is there any simple way to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 11:14:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600668#M209089</guid>
      <dc:creator>biju_babu</dc:creator>
      <dc:date>2022-06-06T11:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown token display name and value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600680#M209091</link>
      <description>&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;The only way is the one described in my previous answer.&lt;/P&gt;&lt;P&gt;There could be another solution using two tokens with the second related to the first, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="source"&amp;gt;
      &amp;lt;label&amp;gt;source choose&amp;lt;/label&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;
            index=your_index
            | dedup source
            | sort source
            | table source
        &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;fieldForLabel&amp;gt;source&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;source&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="Value"&amp;gt;
      &amp;lt;label&amp;gt;Value choose&amp;lt;/label&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;
            index=your_index source="$source$"
            | dedup value
            | sort value
            | table value
        &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;fieldForLabel&amp;gt;value&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;value&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Title&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;
            index=main sourcetype="access_combined" source="$source$" "$value$"
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$Time.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$Time.latest$&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;option name="refresh.display"&amp;gt;progressbar&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;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 12:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600680#M209091</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-06T12:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: dropdown token display name and value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600700#M209099</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;Giuseppe.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by the way i was using dashboard studio not the classic xml. I was thinking another way to do this by using token value as string with both values separated by some character (;) and use split method to get the value. I will check you method too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 13:59:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-get-dropdown-token-display-name-and-value/m-p/600700#M209099</guid>
      <dc:creator>biju_babu</dc:creator>
      <dc:date>2022-06-06T13:59:14Z</dc:date>
    </item>
  </channel>
</rss>

