<?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: How to convert the values of multiple fields to number? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383380#M111954</link>
    <description>&lt;P&gt;Can I get the raw data?&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jun 2018 05:23:29 GMT</pubDate>
    <dc:creator>ansif</dc:creator>
    <dc:date>2018-06-14T05:23:29Z</dc:date>
    <item>
      <title>How to convert the values of multiple fields to number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383377#M111951</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Good day!&lt;/P&gt;

&lt;P&gt;I just want to ask for some help here. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I have multiple fields with the data I'm working on with values, "0, 1, 2, 3, 4, 5, NULL".&lt;BR /&gt;
Ex.&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5194iB5953C4AD2E6635D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I replace the "NULL" values and replace it with space, " ", and add all of these fields and put it in a new field with this code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| replace NULL WITH " " IN "FIELD A" "FIELD B" "FIELD C" "FIELD D" "FIELD E"
| eval newField ="FIELD A" +  " FIELD B" + " FIELD C" + "" FIELD D" + " FIELD E"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But instead of adding the values of the fields, it concatenates it like like this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5195iCAA34AC83A4918C4/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Notice that the events where there was a "NULL" values where seem to be treated as a string.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I tried to use the &lt;CODE&gt;tonumber()&lt;/CODE&gt; function to convert it to string but it doesn't work.&lt;BR /&gt;
Ex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval "FIELD A" = tonumber("FIELD A")
|eval "FIELD B" = tonumber("FIELD B")
|eval "FIELD C" = tonumber("FIELD C")
|eval "FIELD D" = tonumber("FIELD D")
|eval "FIELD E" = tonumber("FIELD E")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What could be the possible cause of this issue and what could be the solution?&lt;/P&gt;

&lt;P&gt;Thanks! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 04:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383377#M111951</guid>
      <dc:creator>jvmerilla</dc:creator>
      <dc:date>2018-06-14T04:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the values of multiple fields to number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383378#M111952</link>
      <description>&lt;P&gt;Remove double quotes for newfield calculation and try.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 04:52:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383378#M111952</guid>
      <dc:creator>ansif</dc:creator>
      <dc:date>2018-06-14T04:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the values of multiple fields to number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383379#M111953</link>
      <description>&lt;P&gt;Hi @ansif,&lt;/P&gt;

&lt;P&gt;I have also tried it already but it still doesn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 05:12:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383379#M111953</guid>
      <dc:creator>jvmerilla</dc:creator>
      <dc:date>2018-06-14T05:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the values of multiple fields to number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383380#M111954</link>
      <description>&lt;P&gt;Can I get the raw data?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 05:23:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383380#M111954</guid>
      <dc:creator>ansif</dc:creator>
      <dc:date>2018-06-14T05:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the values of multiple fields to number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383381#M111955</link>
      <description>&lt;P&gt;Hi @ansif,&lt;/P&gt;

&lt;P&gt;I'm sorry but I cannot provide the raw data to you. But why do you need it?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 05:29:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383381#M111955</guid>
      <dc:creator>jvmerilla</dc:creator>
      <dc:date>2018-06-14T05:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the values of multiple fields to number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383382#M111956</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|replace NULL with 0|eval newField ='FIELD A' +  'FIELD B' + 'FIELD C' + 'FIELD D' + 'FIELD E'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jun 2018 08:27:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-the-values-of-multiple-fields-to-number/m-p/383382#M111956</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-06-14T08:27:26Z</dc:date>
    </item>
  </channel>
</rss>

