<?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: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477674#M134035</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;.  Thank you.  Sorry, I'm not explaining myself clearly.  This query is part of a dashboard panel that relies on user inputs from a drop down menu with three choices.  Either "2019" , "2020" or both with choice "Rolling 2019-2020".  &lt;/P&gt;

&lt;P&gt;The token used for the drop down menu input is $date$.  If the user selects the "Rolling 2019-2020" choice,  then the token $date$ will be "2019-Present".  Based on the choice of the user as seen in the XML listed below, I need to do an eval,  if  "2019-Present" is the value of $date$ then date_tok will return, in this exact format, the value of  '"&lt;EM&gt;/2019","&lt;/EM&gt;/2020"' .   I get no results from this.  I'm having trouble passing through '"&lt;EM&gt;/2019","&lt;/EM&gt;/2020"'  to the |search &lt;STRONG&gt;OpenedOn IN(date_tok)&lt;/STRONG&gt;  to filter the results.  &lt;/P&gt;

&lt;P&gt;======================================================================================&lt;BR /&gt;
&lt;STRONG&gt;Here is the xml of the input Date input:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;input type="dropdown" token="date" searchWhenChanged="true"&amp;gt;
    &amp;lt;label&amp;gt;Year&amp;lt;/label&amp;gt;
    &amp;lt;choice value="2019-Present"&amp;gt;Rolling 2019-2020&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="2019"&amp;gt;2019&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="2020"&amp;gt;2020&amp;lt;/choice&amp;gt;
  &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;=====================================================================================&lt;BR /&gt;
&lt;STRONG&gt;Dashboard Panel query&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;...base search&lt;/P&gt;

&lt;P&gt;| eval date=$date$&lt;BR /&gt;
| eval date_tok=case(date=2019-Present,'"&lt;EM&gt;/2019","&lt;/EM&gt;/2020"' ,date=2019,"&lt;EM&gt;/2019" ,date=2020,"&lt;/EM&gt;/2020")&lt;BR /&gt;
| eval OpenedOn=date_tok&lt;/P&gt;

&lt;P&gt;| search "Change Type" IN("$form.changerequesttype$") &lt;STRONG&gt;&lt;EM&gt;OpenedOn IN(date_tok)&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
| bin span=1mon OpenedOn &lt;BR /&gt;
| chart count(sys_id) as count over OpenedOn_2 by "Business Service"  limit=0 | addtotals&lt;/P&gt;

&lt;P&gt;======================================================================================&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 05:06:10 GMT</pubDate>
    <dc:creator>motaghis</dc:creator>
    <dc:date>2020-09-30T05:06:10Z</dc:date>
    <item>
      <title>Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477670#M134031</link>
      <description>&lt;P&gt;There are three conditions in my eval:&lt;BR /&gt;
1) date=2019-Present, '"/2019","/2020"' &lt;BR /&gt;
2) date=2019,  " /2019"&lt;BR /&gt;
3) date=2020, "/2020"&lt;/P&gt;

&lt;P&gt;Non of the condition values pass through to &lt;EM&gt;**OpenedOn IN(&lt;/EM&gt;&lt;EM&gt;dtok&lt;/EM&gt;&lt;EM&gt;)&lt;/EM&gt;**  as expected.   In the example below,  &lt;STRONG&gt;&lt;EM&gt;OpenedOn IN(dtok)&lt;/EM&gt;&lt;/STRONG&gt; should result in &lt;STRONG&gt;&lt;EM&gt;OpenedOn IN('"&lt;/EM&gt;/2019","*/2020"')&lt;/STRONG&gt;*. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..base search

| eval date=2019-Present
| eval dtok=case(date=2019-Present, **'"*/2019","*/2020"'**  ,date=2019,  " /2019",  date=2020, "/2020")
| search  OpenedOn IN(**dtok**)
| bin span=1mon OpenedOn
| chart count(sys_id) as count over OpenedOn_2 by "Business Service"  limit=0 | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2020 06:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477670#M134031</guid>
      <dc:creator>motaghis</dc:creator>
      <dc:date>2020-04-18T06:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477671#M134032</link>
      <description>&lt;P&gt;Use &lt;CODE&gt;match&lt;/CODE&gt; function with &lt;CODE&gt;where&lt;/CODE&gt; command. Try this query. Here OpenedOn is matched to "/2019" OR "/2020" when date is "2019-Present".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ..base search

 | eval date=2019-Present
 | eval dtok=case(date="2019-Present", "(/2019|/2020)", date="2019", "/2019",  date="2020", "/2020")
 | where match(OpenedOn, dtok)
 | bin span=1mon OpenedOn
 | chart count(sys_id) as count over OpenedOn_2 by "Business Service"  limit=0 | addtotals
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Apr 2020 13:09:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477671#M134032</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-04-18T13:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477672#M134033</link>
      <description>&lt;P&gt;Thank you for your quick response.  I tried this query and it doesn't work.   My issue is I need OpenedOn to equal  "&lt;EM&gt;/2019" and "&lt;/EM&gt;/2020" in this format  ' "&lt;EM&gt;/2019","&lt;/EM&gt;/2020" ' then use | search OpenedOn IN(dtok) to filter the results for all values that were created in 2019 and 2020.&lt;/P&gt;

&lt;P&gt;...base search&lt;/P&gt;

&lt;P&gt;| eval date=2019&lt;BR /&gt;
  | eval dtok=case(date="2019-Present", "(&lt;EM&gt;/2019|&lt;/EM&gt;/2020)", date="2019", "&lt;EM&gt;/2019",  date="2020", "&lt;/EM&gt;/2020")&lt;BR /&gt;
  | where match(OpenedOn, dtok)&lt;BR /&gt;
  | bin span=1mon OpenedOn&lt;BR /&gt;
  | chart count(sys_id) as count over OpenedOn_2 by "Business Service"  limit=0 | addtotals&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:06:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477672#M134033</guid>
      <dc:creator>motaghis</dc:creator>
      <dc:date>2020-09-30T05:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477673#M134034</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;..base search (OpenedOn="*/2019" OR OpenedOn="*/2020") 

| bin span=1mon OpenedOn 
| chart count(sys_id) as count over OpenedOn_2 by "Business Service" limit=0 
| addtotals
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi @motaghis&lt;BR /&gt;
you don't need &lt;CODE&gt;eval&lt;/CODE&gt; and &lt;CODE&gt;where&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;try &lt;CODE&gt;search&lt;/CODE&gt; first. no problem.&lt;BR /&gt;
and &lt;CODE&gt;*/2019&lt;/CODE&gt; and &lt;CODE&gt;/2019&lt;/CODE&gt; is same.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2020 21:57:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477673#M134034</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-18T21:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477674#M134035</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;.  Thank you.  Sorry, I'm not explaining myself clearly.  This query is part of a dashboard panel that relies on user inputs from a drop down menu with three choices.  Either "2019" , "2020" or both with choice "Rolling 2019-2020".  &lt;/P&gt;

&lt;P&gt;The token used for the drop down menu input is $date$.  If the user selects the "Rolling 2019-2020" choice,  then the token $date$ will be "2019-Present".  Based on the choice of the user as seen in the XML listed below, I need to do an eval,  if  "2019-Present" is the value of $date$ then date_tok will return, in this exact format, the value of  '"&lt;EM&gt;/2019","&lt;/EM&gt;/2020"' .   I get no results from this.  I'm having trouble passing through '"&lt;EM&gt;/2019","&lt;/EM&gt;/2020"'  to the |search &lt;STRONG&gt;OpenedOn IN(date_tok)&lt;/STRONG&gt;  to filter the results.  &lt;/P&gt;

&lt;P&gt;======================================================================================&lt;BR /&gt;
&lt;STRONG&gt;Here is the xml of the input Date input:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;input type="dropdown" token="date" searchWhenChanged="true"&amp;gt;
    &amp;lt;label&amp;gt;Year&amp;lt;/label&amp;gt;
    &amp;lt;choice value="2019-Present"&amp;gt;Rolling 2019-2020&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="2019"&amp;gt;2019&amp;lt;/choice&amp;gt;
    &amp;lt;choice value="2020"&amp;gt;2020&amp;lt;/choice&amp;gt;
  &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;=====================================================================================&lt;BR /&gt;
&lt;STRONG&gt;Dashboard Panel query&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;...base search&lt;/P&gt;

&lt;P&gt;| eval date=$date$&lt;BR /&gt;
| eval date_tok=case(date=2019-Present,'"&lt;EM&gt;/2019","&lt;/EM&gt;/2020"' ,date=2019,"&lt;EM&gt;/2019" ,date=2020,"&lt;/EM&gt;/2020")&lt;BR /&gt;
| eval OpenedOn=date_tok&lt;/P&gt;

&lt;P&gt;| search "Change Type" IN("$form.changerequesttype$") &lt;STRONG&gt;&lt;EM&gt;OpenedOn IN(date_tok)&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
| bin span=1mon OpenedOn &lt;BR /&gt;
| chart count(sys_id) as count over OpenedOn_2 by "Business Service"  limit=0 | addtotals&lt;/P&gt;

&lt;P&gt;======================================================================================&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:06:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477674#M134035</guid>
      <dc:creator>motaghis</dc:creator>
      <dc:date>2020-09-30T05:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477675#M134036</link>
      <description>&lt;P&gt;I see. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form hideEdit="false"&amp;gt;
  &amp;lt;label&amp;gt;Input dropdown test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset autoRun="true" submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="date" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Year&amp;lt;/label&amp;gt;
      &amp;lt;choice value="2019-Present"&amp;gt;Rolling 2019-2020&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="2019"&amp;gt;2019&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="2020"&amp;gt;2020&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="2019-Present"&amp;gt;
          &amp;lt;set token="tok_text_1"&amp;gt;/2019 OR /2020&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition value="2019"&amp;gt;
          &amp;lt;set token="tok_text_1"&amp;gt;2019&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
          &amp;lt;set token="tok_text_1"&amp;gt;2020&amp;lt;/set&amp;gt;
        &amp;lt;/condition&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;title&amp;gt;Token 1: $date$ | Token 2: $tok_text_1$&amp;lt;/title&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;

&lt;P&gt;this is sample dashboard. try this.&lt;BR /&gt;
Splunk dashboard can send two tokens at same time.&lt;/P&gt;

&lt;P&gt;I don't know whole your query. you can create dashboard.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 06:11:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477675#M134036</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-19T06:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Please help....I'm using |eval case() with multiple values and need help with passing through the values to an IN() search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477676#M134037</link>
      <description>&lt;P&gt;This works beautifully!   Thank you so much @to4kawa!!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 06:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Please-help-I-m-using-eval-case-with-multiple-values-and-need/m-p/477676#M134037</guid>
      <dc:creator>motaghis</dc:creator>
      <dc:date>2020-04-19T06:31:24Z</dc:date>
    </item>
  </channel>
</rss>

