<?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: Error in 'eval' command: The expression is malformed. An unexpected character is reached at ') , user)'. Help Please in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/526327#M148556</link>
    <description>&lt;LI-CODE lang="markup"&gt;| eval unc=mvcount(user_num ) 
| eval actual_user=if((unc!=1), 
   [
    index=indexA user=ABC123
    | eval USER_NAME_FROM_ACEE="\"".USER_NAME_FROM_ACEE."\""
    | table USER_NAME_FROM_ACEE
   ],
    user)
| table actual_user&lt;/LI-CODE&gt;&lt;P&gt;how about this?&lt;/P&gt;</description>
    <pubDate>Sat, 24 Oct 2020 11:49:07 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-10-24T11:49:07Z</dc:date>
    <item>
      <title>Error in 'eval' command: The expression is malformed. An unexpected character is reached at ') , user)'. Help Please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/526145#M148504</link>
      <description>&lt;P&gt;I have a search running fine by itself,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=indexA user=ABC123 
| where isnotnull(USER_NAME_FROM_ACEE) 
| table USER_NAME_FROM_ACEE 
| dedup USER_NAME_FROM_ACEE 
| return $USER_NAME_FROM_ACEE&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but if I put the search as a subsearch in if statement as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval unc=mvcount(user_num ) 
| eval actual_user=if((unc!=1), 
   [
    index=indexA user=ABC123 
    | where isnotnull(USER_NAME_FROM_ACEE) 
    | table USER_NAME_FROM_ACEE 
    | dedup USER_NAME_FROM_ACEE 
    | return $USER_NAME_FROM_ACEE
   ],
    user)
| table actual_user&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it will throw me the errro ""Error in 'eval' command: The expression is malformed. An unexpected character is reached at ') , user)'.&lt;/P&gt;&lt;P&gt;I did test to simplify the search and&amp;nbsp; find the problem is the filed name part"USER_NAME_FROM_ACEE"&lt;/P&gt;&lt;P&gt;if I do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval unc=mvcount(user_num ) 
| eval actual_user=if((unc!=1), 
   [
    index=indexA user=ABC123 
    | table user
   ],
    user)
| table actual_user&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works fine, but if I do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval unc=mvcount(user_num ) 
| eval actual_user=if((unc!=1), 
   [
    index=indexA user=ABC123 
    | table USER_NAME_FROM_ACEE
   ],
    user)
| table actual_user&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it will throw me the error, which totally does not make sense to me, any suggestion why it is like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 22:31:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/526145#M148504</guid>
      <dc:creator>samlinsongguo</dc:creator>
      <dc:date>2020-10-22T22:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at ') , user)'. Help Please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/526327#M148556</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval unc=mvcount(user_num ) 
| eval actual_user=if((unc!=1), 
   [
    index=indexA user=ABC123
    | eval USER_NAME_FROM_ACEE="\"".USER_NAME_FROM_ACEE."\""
    | table USER_NAME_FROM_ACEE
   ],
    user)
| table actual_user&lt;/LI-CODE&gt;&lt;P&gt;how about this?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 11:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/526327#M148556</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-10-24T11:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at ') , user)'. Help Please</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/527199#M148818</link>
      <description>&lt;P&gt;I find the problem is actually not the field name it is the result subsearch produced or I should say "&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| return $USER_NAME_FROM_ACEE&lt;/LI-CODE&gt;&lt;P&gt;return empty result which cause the search run as&lt;/P&gt;&lt;P&gt;| eval actual_user=if((unc=1), user, ( ( "" ) ) | table actual_user&lt;/P&gt;&lt;P&gt;and it caused error.&lt;/P&gt;&lt;P&gt;find the root cause by adding "format" command at the end of my search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;   index=indexA user=ABC123 
    | where isnotnull(USER_NAME_FROM_ACEE) 
    | table USER_NAME_FROM_ACEE 
    | dedup USER_NAME_FROM_ACEE 
    | return $USER_NAME_FROM_ACEE
    | format&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 30 Oct 2020 02:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/527199#M148818</guid>
      <dc:creator>samlinsongguo</dc:creator>
      <dc:date>2020-10-30T02:59:28Z</dc:date>
    </item>
  </channel>
</rss>

