<?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 Calculated field return invalid operator error in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403450#M3522</link>
    <description>&lt;P&gt;I've a field called "NUMBER" which has values as shown below:&lt;/P&gt;

&lt;P&gt;NUMBER&lt;BR /&gt;
0000123&lt;BR /&gt;
001200&lt;BR /&gt;
0000004567&lt;BR /&gt;
00008780&lt;/P&gt;

&lt;P&gt;I need it to be converted as below:&lt;/P&gt;

&lt;P&gt;NUM&lt;BR /&gt;
1.23&lt;BR /&gt;
12.00&lt;BR /&gt;
45.67&lt;BR /&gt;
87.80&lt;/P&gt;

&lt;P&gt;To do so I can use following splunk query:&lt;/P&gt;

&lt;P&gt;| eval NUM=ltrim(tostring(NUMBER),"0") | eval NUM=(NUM/100) | eval NUM=round(NUM,2) |&lt;/P&gt;

&lt;P&gt;However I want it be a "calculated field" so that I can run queries direclty using a "NUM" field. But "Calculated Field" is throwing an error "Invalid Operator". Can someone please suggest how can I use it? &lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2019 15:35:53 GMT</pubDate>
    <dc:creator>vinayr9</dc:creator>
    <dc:date>2019-04-09T15:35:53Z</dc:date>
    <item>
      <title>Calculated field return invalid operator error</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403450#M3522</link>
      <description>&lt;P&gt;I've a field called "NUMBER" which has values as shown below:&lt;/P&gt;

&lt;P&gt;NUMBER&lt;BR /&gt;
0000123&lt;BR /&gt;
001200&lt;BR /&gt;
0000004567&lt;BR /&gt;
00008780&lt;/P&gt;

&lt;P&gt;I need it to be converted as below:&lt;/P&gt;

&lt;P&gt;NUM&lt;BR /&gt;
1.23&lt;BR /&gt;
12.00&lt;BR /&gt;
45.67&lt;BR /&gt;
87.80&lt;/P&gt;

&lt;P&gt;To do so I can use following splunk query:&lt;/P&gt;

&lt;P&gt;| eval NUM=ltrim(tostring(NUMBER),"0") | eval NUM=(NUM/100) | eval NUM=round(NUM,2) |&lt;/P&gt;

&lt;P&gt;However I want it be a "calculated field" so that I can run queries direclty using a "NUM" field. But "Calculated Field" is throwing an error "Invalid Operator". Can someone please suggest how can I use it? &lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 15:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403450#M3522</guid>
      <dc:creator>vinayr9</dc:creator>
      <dc:date>2019-04-09T15:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field return invalid operator error</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403451#M3523</link>
      <description>&lt;P&gt;Are you putting all three EVAL statements in single calculated fields entry??&lt;/P&gt;

&lt;P&gt;Also, try this for expression while saving the calculated field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;replace(NUMBER,"^(0*)(\d*)(\d{2})","\2.\3")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 21:23:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403451#M3523</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-09T21:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field return invalid operator error</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403452#M3524</link>
      <description>&lt;P&gt;Yes I was trying to add three eval statements in a single calculated fields entry. Guess that's not allowed. If I put them in three different calculated fields then it takes too long for the search query.&lt;/P&gt;

&lt;P&gt;The expression you provided helps but appears searching on calculated fields takes more time than normal. Is there a better way of doing it? &lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 15:27:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403452#M3524</guid>
      <dc:creator>vinayr9</dc:creator>
      <dc:date>2019-04-10T15:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field return invalid operator error</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403453#M3525</link>
      <description>&lt;P&gt;Handle it inline in search, may be create a macro for it and call the macro in your search.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 15:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403453#M3525</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-10T15:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field return invalid operator error</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403454#M3526</link>
      <description>&lt;P&gt;OK thanks. I'll try.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 16:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403454#M3526</guid>
      <dc:creator>vinayr9</dc:creator>
      <dc:date>2019-04-10T16:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field return invalid operator error</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403455#M3527</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Give a try like this in props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::test.csv]
EVAL-NUM = round(tonumber(NUMBER)/100,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 12:31:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Calculated-field-return-invalid-operator-error/m-p/403455#M3527</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-04-11T12:31:19Z</dc:date>
    </item>
  </channel>
</rss>

