<?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 Error in Case Statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-Case-Statement/m-p/35926#M7923</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a case statement as mentioned below:&lt;/P&gt;

&lt;P&gt;eval MODEVAL = case(mode=="modeA", if (FieldA!=0,FieldA/1024,NULL),mode=="modeB",lookup csv_modes Header1 AS mode_name OUTPUT mode)&lt;/P&gt;

&lt;P&gt;I get an error. "Error in 'eval' command: The expression is malformed. Expected )."&lt;/P&gt;

&lt;P&gt;If i replace the lookup  with NULL part in the above expression, it works fine.&lt;BR /&gt;
eval MODEVAL = case(mode=="modeA", if (FieldA!=0,FieldA/1024,NULL),mode=="modeB",NULL)&lt;/P&gt;

&lt;P&gt;My CSV file is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Header1,Header2
A,1
B,2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I even changed CSV to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Header1","Header2"
"A","1"
"B","2"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get same error.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Strive&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:48:43 GMT</pubDate>
    <dc:creator>strive</dc:creator>
    <dc:date>2020-09-28T12:48:43Z</dc:date>
    <item>
      <title>Error in Case Statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-Case-Statement/m-p/35926#M7923</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a case statement as mentioned below:&lt;/P&gt;

&lt;P&gt;eval MODEVAL = case(mode=="modeA", if (FieldA!=0,FieldA/1024,NULL),mode=="modeB",lookup csv_modes Header1 AS mode_name OUTPUT mode)&lt;/P&gt;

&lt;P&gt;I get an error. "Error in 'eval' command: The expression is malformed. Expected )."&lt;/P&gt;

&lt;P&gt;If i replace the lookup  with NULL part in the above expression, it works fine.&lt;BR /&gt;
eval MODEVAL = case(mode=="modeA", if (FieldA!=0,FieldA/1024,NULL),mode=="modeB",NULL)&lt;/P&gt;

&lt;P&gt;My CSV file is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Header1,Header2
A,1
B,2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I even changed CSV to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Header1","Header2"
"A","1"
"B","2"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get same error.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Strive&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-Case-Statement/m-p/35926#M7923</guid>
      <dc:creator>strive</dc:creator>
      <dc:date>2020-09-28T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Case Statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-Case-Statement/m-p/35927#M7924</link>
      <description>&lt;P&gt;Uh, that's not valid syntax for eval/case at all. You can't use just any command in the statement, it has to be one of those functions supported by eval.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2012 17:02:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-Case-Statement/m-p/35927#M7924</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-11-15T17:02:47Z</dc:date>
    </item>
  </channel>
</rss>

