<?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 populated by search ok, now how to set a token based on an alternate field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667616#M229037</link>
    <description>&lt;PRE&gt;&amp;lt;input type="dropdown" token="tok_choice" searchWhenChanged="true"&amp;gt;&lt;BR /&gt;  &amp;lt;fieldForLabel&amp;gt;host&amp;lt;/fieldForLabel&amp;gt;&lt;BR /&gt;  &amp;lt;fieldForValue&amp;gt;host&amp;lt;/fieldForValue&amp;gt;&lt;BR /&gt;  &amp;lt;search&amp;gt;&lt;BR /&gt;    &amp;lt;query&amp;gt; ... | stats dc(field2) as field2number by host &amp;lt;/query&amp;gt;&lt;BR /&gt;  &amp;lt;/search&amp;gt;&lt;BR /&gt;  &amp;lt;change&amp;gt;&lt;BR /&gt;    &amp;lt;condition match=" like($tok_choice$,&amp;amp;quot;%&amp;amp;quot;) "&amp;gt;&lt;BR /&gt;      &amp;lt;set token="show_another_panel"&amp;gt;show&amp;lt;/set&amp;gt;&lt;BR /&gt;      &amp;lt;set token="another_result"&amp;gt; $result.field2number$ &amp;lt;/set&amp;gt;&lt;BR /&gt;    &amp;lt;/condition&amp;gt;&lt;BR /&gt;  &amp;lt;/change&amp;gt;&lt;BR /&gt;&amp;lt;/input&amp;gt;&lt;/PRE&gt;&lt;P&gt;The token for 'show_another_panel' is working just fine but the other token is treating the whole $result.field2number$ as full text including the $.&amp;nbsp; The drop down is working as expected with fieldForLabel and fieldForValue.&lt;/P&gt;&lt;P&gt;I have tried the following.&lt;/P&gt;&lt;PRE&gt;&amp;lt;done&amp;gt;&lt;BR /&gt;  &amp;lt;set token="another_result"&amp;gt; $result.field2number$ &amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/done&amp;gt;&lt;/PRE&gt;&lt;P&gt;This sets the token to the field2number first row.&amp;nbsp; The value does not update to the row based upon selecting a new host.&lt;/P&gt;&lt;P&gt;When selecting a new host, I want the token to update to the corresponding value of the alternate row.&amp;nbsp; Any suggestions?&lt;/P&gt;</description>
    <pubDate>Mon, 06 Nov 2023 21:47:47 GMT</pubDate>
    <dc:creator>dural_yyz</dc:creator>
    <dc:date>2023-11-06T21:47:47Z</dc:date>
    <item>
      <title>Dropdown populated by search ok, now how to set a token based on an alternate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667616#M229037</link>
      <description>&lt;PRE&gt;&amp;lt;input type="dropdown" token="tok_choice" searchWhenChanged="true"&amp;gt;&lt;BR /&gt;  &amp;lt;fieldForLabel&amp;gt;host&amp;lt;/fieldForLabel&amp;gt;&lt;BR /&gt;  &amp;lt;fieldForValue&amp;gt;host&amp;lt;/fieldForValue&amp;gt;&lt;BR /&gt;  &amp;lt;search&amp;gt;&lt;BR /&gt;    &amp;lt;query&amp;gt; ... | stats dc(field2) as field2number by host &amp;lt;/query&amp;gt;&lt;BR /&gt;  &amp;lt;/search&amp;gt;&lt;BR /&gt;  &amp;lt;change&amp;gt;&lt;BR /&gt;    &amp;lt;condition match=" like($tok_choice$,&amp;amp;quot;%&amp;amp;quot;) "&amp;gt;&lt;BR /&gt;      &amp;lt;set token="show_another_panel"&amp;gt;show&amp;lt;/set&amp;gt;&lt;BR /&gt;      &amp;lt;set token="another_result"&amp;gt; $result.field2number$ &amp;lt;/set&amp;gt;&lt;BR /&gt;    &amp;lt;/condition&amp;gt;&lt;BR /&gt;  &amp;lt;/change&amp;gt;&lt;BR /&gt;&amp;lt;/input&amp;gt;&lt;/PRE&gt;&lt;P&gt;The token for 'show_another_panel' is working just fine but the other token is treating the whole $result.field2number$ as full text including the $.&amp;nbsp; The drop down is working as expected with fieldForLabel and fieldForValue.&lt;/P&gt;&lt;P&gt;I have tried the following.&lt;/P&gt;&lt;PRE&gt;&amp;lt;done&amp;gt;&lt;BR /&gt;  &amp;lt;set token="another_result"&amp;gt; $result.field2number$ &amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/done&amp;gt;&lt;/PRE&gt;&lt;P&gt;This sets the token to the field2number first row.&amp;nbsp; The value does not update to the row based upon selecting a new host.&lt;/P&gt;&lt;P&gt;When selecting a new host, I want the token to update to the corresponding value of the alternate row.&amp;nbsp; Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 21:47:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667616#M229037</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2023-11-06T21:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dropdown populated by search ok, now how to set a token based on an alternate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667617#M229038</link>
      <description>&lt;P&gt;Within the change tag have you tried to reference the $label$ or $value$ from the dynamic search using these tokens?&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;          &amp;lt;set token="show_another_panel"&amp;gt;$label$&amp;lt;/set&amp;gt;
          &amp;lt;set token="another_result"&amp;gt;$value$&amp;lt;/set&amp;gt;&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;Here's a basic SimpleXML page with a dynamic dropdown and a couple HTML panels to show the value of the tokens being set:&lt;/SPAN&gt;&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;&amp;lt;form version="1.1"&amp;gt;
  &amp;lt;label&amp;gt;Dropdown Test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="field1"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;sourcetype&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;source_dc&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;index=_internal earliest=-6h | stats dc(source) as source_dc by sourcetype&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;change&amp;gt;
        &amp;lt;set token="show_another_panel"&amp;gt;$label$&amp;lt;/set&amp;gt;
        &amp;lt;set token="another_result"&amp;gt;$value$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;$show_another_panel$&amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;$another_result$&amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&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;Per &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#change_.28form_input.29" target="_self"&gt;&lt;SPAN&gt;change (form input)&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 22:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667617#M229038</guid>
      <dc:creator>_JP</dc:creator>
      <dc:date>2023-11-06T22:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dropdown populated by search ok, now how to set a token based on an alternate field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667619#M229039</link>
      <description>&lt;P&gt;Not exactly what I was looking for.&amp;nbsp; I have the Label and Value mapped to field 1 as that is the user friendly value and unique.&amp;nbsp; I have field 2 which means nothing to my users and is a varied value field.&lt;/P&gt;&lt;P&gt;The Label/Value combo feeds panel_A chart which works very well.&amp;nbsp; I have panel_B chart which I would like powered from field2 without having to create a second drop down with the same values.&amp;nbsp; Two for the price of one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going to try and make the Label field a combo of the 2 and then set a token to a regex extraction from $Label which may just work.&amp;nbsp; But I feel it's janky and cheating.&amp;nbsp; I am hoping someone will have a much better idea.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 23:17:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dropdown-populated-by-search-ok-now-how-to-set-a-token-based-on/m-p/667619#M229039</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2023-11-06T23:17:37Z</dc:date>
    </item>
  </channel>
</rss>

