<?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: case - expression is malformed in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318021#M95163</link>
    <description>&lt;P&gt;The above answers would be correct but you can try this one also.&lt;/P&gt;

&lt;P&gt;index="index_name" Account_Name=smithjt OR Account_Name=jonestt&lt;BR /&gt;
|eval X1=case (like(Account_Name,"%smithjt%"),"John T Smith", like(Account_Name,"jonestt"), "Tom T Jones")&lt;BR /&gt;
|table Account_Name, X1&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:59:21 GMT</pubDate>
    <dc:creator>abhijeet01</dc:creator>
    <dc:date>2020-09-29T18:59:21Z</dc:date>
    <item>
      <title>case - expression is malformed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318017#M95159</link>
      <description>&lt;P&gt;What am I doing wrong?&lt;BR /&gt;
* Account_Name=smithjt OR Account_Name=jonestt*&lt;BR /&gt;
|eval X1=case (Account_Name=="smithjt", "John T Smith", Account_Name=="jonestt", "Tom T Jones")&lt;BR /&gt;
|table Account_Name, X1&lt;/P&gt;

&lt;P&gt;I get --- Error in 'eval' command:  The expression is malformed.  An unexpected character is reached at "Tom T Jones"&lt;/P&gt;

&lt;P&gt;I have tried replacing == with ==, putting in " marks and taking them out.  What is the unexpected character?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318017#M95159</guid>
      <dc:creator>jtitus3</dc:creator>
      <dc:date>2020-09-29T18:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: case - expression is malformed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318018#M95160</link>
      <description>&lt;P&gt;there shouldn't be anything wrong.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|makeresults|eval Account_Name="jonestt"|eval X1=case (Account_Name="smithjt", "John T Smith", Account_Name="jonestt", "Tom T Jones")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I did this with both&lt;CODE&gt;==&lt;/CODE&gt; and &lt;CODE&gt;=&lt;/CODE&gt; and it worked just fine. what version are you on?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 19:00:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318018#M95160</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-04-09T19:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: case - expression is malformed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318019#M95161</link>
      <description>&lt;P&gt;Try retyping the query in search bar (OR in notepad and then copy the query).&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 19:40:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318019#M95161</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-09T19:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: case - expression is malformed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318020#M95162</link>
      <description>&lt;P&gt;I think the major problem was that there were two Account_Names but if there is only one Account_Name the search still works well.  Spacing seemed to be important and quotes are required.&lt;BR /&gt;
* Account_Name=smithja OR Account_Name=jonesst* OR Account_Name=davisgs&lt;BR /&gt;
|eval name1=mvindex(Account_Name,0)&lt;BR /&gt;
|eval name2=mvindex(Account_Name,1)&lt;BR /&gt;
|eval FN1=case(name1==”smitha”, ”John A Smith”,&lt;BR /&gt;
        name1==”jonesst”, ”Steve T Jones”,&lt;BR /&gt;
        name1==”jonesst-admin”, ”Steve T Jones”,&lt;BR /&gt;
        name1==”davisgs”, “Gregg S Davis”)&lt;BR /&gt;
|eval FN2=case(name2==”smitha”, ”John A Smith”,&lt;BR /&gt;
        Name2==”jonesst”, ”Steve T Jones”,&lt;BR /&gt;
        Name2==”jonesst-admin”, ”Steve T Jones”,&lt;BR /&gt;
        Name2==”davisgs”, “Gregg S Davis”)&lt;BR /&gt;
|table name1, FN1, name2, FN2&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:59:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318020#M95162</guid>
      <dc:creator>jtitus3</dc:creator>
      <dc:date>2020-09-29T18:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: case - expression is malformed</title>
      <link>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318021#M95163</link>
      <description>&lt;P&gt;The above answers would be correct but you can try this one also.&lt;/P&gt;

&lt;P&gt;index="index_name" Account_Name=smithjt OR Account_Name=jonestt&lt;BR /&gt;
|eval X1=case (like(Account_Name,"%smithjt%"),"John T Smith", like(Account_Name,"jonestt"), "Tom T Jones")&lt;BR /&gt;
|table Account_Name, X1&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:59:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/case-expression-is-malformed/m-p/318021#M95163</guid>
      <dc:creator>abhijeet01</dc:creator>
      <dc:date>2020-09-29T18:59:21Z</dc:date>
    </item>
  </channel>
</rss>

