<?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 keep leading zeros in a numeric field when converting it to string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169184#M186229</link>
    <description>&lt;P&gt;thanks for your help&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2014 21:15:02 GMT</pubDate>
    <dc:creator>fere</dc:creator>
    <dc:date>2014-02-27T21:15:02Z</dc:date>
    <item>
      <title>How to keep leading zeros in a numeric field when converting it to string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169182#M186227</link>
      <description>&lt;P&gt;I have this as part of my query:  eval this_move=tostring(seq)."-."screen &lt;BR /&gt;
Only I need to make sure seq is treated as 2 digit number before converting to string.  Is there a way to do that?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2014 20:47:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169182#M186227</guid>
      <dc:creator>fere</dc:creator>
      <dc:date>2014-02-27T20:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep leading zeros in a numeric field when converting it to string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169183#M186228</link>
      <description>&lt;P&gt;This should get you what want you need:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt; | eval temp=if(length(seq)&amp;lt;2,"0"+seq,seq) | eval this_move=temp+"-"+screen
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I split it into two eval statements to make it easier to understand what's going on, but you can consolidate it into a single eval statement if you prefer.&lt;/P&gt;

&lt;P&gt;Note: I assume that "screen" is a string field that you want to concatenate with "seq" field&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2014 21:01:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169183#M186228</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-02-27T21:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep leading zeros in a numeric field when converting it to string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169184#M186229</link>
      <description>&lt;P&gt;thanks for your help&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2014 21:15:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-keep-leading-zeros-in-a-numeric-field-when-converting-it/m-p/169184#M186229</guid>
      <dc:creator>fere</dc:creator>
      <dc:date>2014-02-27T21:15:02Z</dc:date>
    </item>
  </channel>
</rss>

