<?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 eval macro with a case statement errors in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81366#M20611</link>
    <description>&lt;P&gt;source="&lt;EM&gt;PerfMetrics&lt;/EM&gt;" "OPEN PLAN"  OSArch=64-bit PlanMode=Server |&lt;BR /&gt;
transaction Guid startswith="OPEN PLAN START" endswith="OPEN PLAN END" | &lt;BR /&gt;
PlanSize = &lt;CODE&gt;PlanSize&lt;/CODE&gt;  | etc, etc&lt;/P&gt;

&lt;P&gt;(It doesn't display in the question, but there are tic marks around the second Plansize above.&lt;/P&gt;

&lt;P&gt;with a macro of case(NumRows&amp;gt;0 AND NumRows&amp;lt;=50 AND NumDoors&amp;gt;=650, \"S\", NumRows&amp;gt;=200 AND NumRows&amp;lt;=250 AND NumDoors&amp;gt;=650 , \"M\", NumRows &amp;gt;500, \"L\")&lt;/P&gt;

&lt;P&gt;I've tried both with and without escaping the quotes and also having PlanSize = in front of the case as well has having eval Plansize = in front of the case statement. Also, in the calling search I've tried eval PlanSize = &lt;CODE&gt;PlanSize&lt;/CODE&gt;  and just &lt;CODE&gt;PlanSize&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I keep getting:&lt;BR /&gt;
Error in 'SearchParser': The definition of macro 'PlanSize' is expected to be an eval expression that returns a string.&lt;/P&gt;

&lt;P&gt;Don't know any other combinations to try.  Can this even be done using macros?&lt;/P&gt;</description>
    <pubDate>Thu, 03 Oct 2013 14:24:58 GMT</pubDate>
    <dc:creator>RVDowning</dc:creator>
    <dc:date>2013-10-03T14:24:58Z</dc:date>
    <item>
      <title>eval macro with a case statement errors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81366#M20611</link>
      <description>&lt;P&gt;source="&lt;EM&gt;PerfMetrics&lt;/EM&gt;" "OPEN PLAN"  OSArch=64-bit PlanMode=Server |&lt;BR /&gt;
transaction Guid startswith="OPEN PLAN START" endswith="OPEN PLAN END" | &lt;BR /&gt;
PlanSize = &lt;CODE&gt;PlanSize&lt;/CODE&gt;  | etc, etc&lt;/P&gt;

&lt;P&gt;(It doesn't display in the question, but there are tic marks around the second Plansize above.&lt;/P&gt;

&lt;P&gt;with a macro of case(NumRows&amp;gt;0 AND NumRows&amp;lt;=50 AND NumDoors&amp;gt;=650, \"S\", NumRows&amp;gt;=200 AND NumRows&amp;lt;=250 AND NumDoors&amp;gt;=650 , \"M\", NumRows &amp;gt;500, \"L\")&lt;/P&gt;

&lt;P&gt;I've tried both with and without escaping the quotes and also having PlanSize = in front of the case as well has having eval Plansize = in front of the case statement. Also, in the calling search I've tried eval PlanSize = &lt;CODE&gt;PlanSize&lt;/CODE&gt;  and just &lt;CODE&gt;PlanSize&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I keep getting:&lt;BR /&gt;
Error in 'SearchParser': The definition of macro 'PlanSize' is expected to be an eval expression that returns a string.&lt;/P&gt;

&lt;P&gt;Don't know any other combinations to try.  Can this even be done using macros?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81366#M20611</guid>
      <dc:creator>RVDowning</dc:creator>
      <dc:date>2013-10-03T14:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: eval macro with a case statement errors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81367#M20612</link>
      <description>&lt;P&gt;Guessing the macro will need to start with eval myString = case(NumRows&amp;gt;0 etc....  then after you could have | eval PlanSize = myString  because myString will be a value returned from the Macro.   I usually like to write the whole search out, make sure it works and then sub in the macro.  That way I know the syntax and structure is correct first.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:29:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81367#M20612</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2013-10-03T14:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: eval macro with a case statement errors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81368#M20613</link>
      <description>&lt;P&gt;Well, guess I don't understand "Eval based expression."  Once I unchecked that box it worked fine.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:34:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-macro-with-a-case-statement-errors/m-p/81368#M20613</guid>
      <dc:creator>RVDowning</dc:creator>
      <dc:date>2013-10-03T14:34:40Z</dc:date>
    </item>
  </channel>
</rss>

