<?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: How can I get the value of a token as a search eval for another token? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328758#M97862</link>
    <description>&lt;P&gt;@tamduong16, based on your initial query in the question I thought you wanted to default the token &lt;CODE&gt;$result$&lt;/CODE&gt; to &lt;CODE&gt;Name="unit"&lt;/CODE&gt; in case &lt;CODE&gt;All&lt;/CODE&gt; or "*" is selected and if nothing else is selected it should be &lt;CODE&gt;unset&lt;/CODE&gt; or &lt;CODE&gt;null&lt;/CODE&gt;, which was not defined in your question.&lt;/P&gt;

&lt;P&gt;Please give examples with data as to what you want the token &lt;CODE&gt;$result$&lt;/CODE&gt; to be set when All is selected or when any specific Unit value is selected.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2017 21:13:19 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-12-06T21:13:19Z</dc:date>
    <item>
      <title>How can I get the value of a token as a search eval for another token?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328755#M97859</link>
      <description>&lt;P&gt;I have the following xml: &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3971i2F3CFCCD0DFA78A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I want to have Name=$unit$  for the line eval token. And will have other conditions to be Name=$campus$ , etc. But I can't seem to find an escape character for splunk to understand that I want to refer to a token instead of a String. I tried 'unit', $unit$, '$unit$'. But all of them don't work. Will I be able to do this with splunk today? If not, What could be a good work around? Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 01:45:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328755#M97859</guid>
      <dc:creator>tamduong16</dc:creator>
      <dc:date>2017-12-06T01:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the value of a token as a search eval for another token?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328756#M97860</link>
      <description>&lt;P&gt;@tamduong16, you can try something like the following:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Option 1: With condition match and set token&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        &amp;lt;change&amp;gt;
          &amp;lt;condition match="value!=&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
            &amp;lt;set token="result"&amp;gt;Name=&amp;amp;quot;unit&amp;amp;quot;&amp;lt;/set&amp;gt;
          &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2: With eval to set token&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;change&amp;gt;
    &amp;lt;eval token="result"&amp;gt;case($value$!="*","Name=\"unit\"")&amp;lt;/eval&amp;gt;
&amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere dashboard snippet to test out the same.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="dropdown" token="unit" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;Select a unit:&amp;lt;/label&amp;gt;
        &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="UnitA"&amp;gt;UnitA&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="UnitB"&amp;gt;UnitB&amp;lt;/choice&amp;gt;
        &amp;lt;change&amp;gt;
          &amp;lt;condition match="value!=&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
            &amp;lt;set token="result"&amp;gt;Name=&amp;amp;quot;unit&amp;amp;quot;&amp;lt;/set&amp;gt;
          &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
      &amp;lt;/input&amp;gt;      
      &amp;lt;html&amp;gt;
        &amp;lt;div&amp;gt;$unit$ - $result$&amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 02:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328756#M97860</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T02:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the value of a token as a search eval for another token?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328757#M97861</link>
      <description>&lt;P&gt;Hi niketnilay, Thank you for answering my question. I tried the above but the result always comes out as the string unit. For some reason, Splunk keeps translating it to a string but not my token. Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 15:30:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328757#M97861</guid>
      <dc:creator>tamduong16</dc:creator>
      <dc:date>2017-12-06T15:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the value of a token as a search eval for another token?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328758#M97862</link>
      <description>&lt;P&gt;@tamduong16, based on your initial query in the question I thought you wanted to default the token &lt;CODE&gt;$result$&lt;/CODE&gt; to &lt;CODE&gt;Name="unit"&lt;/CODE&gt; in case &lt;CODE&gt;All&lt;/CODE&gt; or "*" is selected and if nothing else is selected it should be &lt;CODE&gt;unset&lt;/CODE&gt; or &lt;CODE&gt;null&lt;/CODE&gt;, which was not defined in your question.&lt;/P&gt;

&lt;P&gt;Please give examples with data as to what you want the token &lt;CODE&gt;$result$&lt;/CODE&gt; to be set when All is selected or when any specific Unit value is selected.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 21:13:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328758#M97862</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-06T21:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the value of a token as a search eval for another token?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328759#M97863</link>
      <description>&lt;P&gt;So the $unit$ token could be anywhere from * to a string like "abc", "cdf123". I have 2 other token name $campus$ and $building$. I want $result$ to be "Name=$campus$$building$*" if $unit$ equal * , and $result$ to be "Name=$unit$" if $unit$ equal something else (for example, "Name=abcd345" when the value of $unit$ is "abcd345"). Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 21:38:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328759#M97863</guid>
      <dc:creator>tamduong16</dc:creator>
      <dc:date>2017-12-06T21:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the value of a token as a search eval for another token?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328760#M97864</link>
      <description>&lt;P&gt;@tamduoung, try the following run anywhere dashboard. I have used init section to mock the campus and building tokens. You can plugin things as per your need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Set token on condition match&amp;lt;/label&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="campus"&amp;gt;MyCampus&amp;lt;/set&amp;gt;
    &amp;lt;set token="building"&amp;gt;BuildingA&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="dropdown" token="unit" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;Select a unit:&amp;lt;/label&amp;gt;
        &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="UnitA"&amp;gt;UnitA&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="UnitB"&amp;gt;UnitB&amp;lt;/choice&amp;gt;
        &amp;lt;change&amp;gt;
           &amp;lt;condition match="value!=&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
             &amp;lt;set token="result"&amp;gt;Name=&amp;amp;quot;$value$&amp;amp;quot;&amp;lt;/set&amp;gt;
           &amp;lt;/condition&amp;gt;
           &amp;lt;condition&amp;gt;
             &amp;lt;set token="result"&amp;gt;Name=&amp;amp;quot;$campus$$building$&amp;amp;quot;&amp;lt;/set&amp;gt;
           &amp;lt;/condition&amp;gt;
        &amp;lt;/change&amp;gt;
      &amp;lt;/input&amp;gt;      
      &amp;lt;html&amp;gt;
        &amp;lt;div&amp;gt;$unit$ - $result$&amp;lt;/div&amp;gt;
      &amp;lt;/html&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, 07 Dec 2017 05:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-get-the-value-of-a-token-as-a-search-eval-for-another/m-p/328760#M97864</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-07T05:09:35Z</dc:date>
    </item>
  </channel>
</rss>

