<?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: Suppressing msg error &amp;quot;wrong string value&amp;quot; or &amp;quot;maybe too large for the field&amp;quot; in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691714#M39238</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am sorry but this code won't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my particularly case, I have to transfer part of string field Left ([TEXTFIELD],10) to a date field type [DATEFIELD].&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;For example:&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT][TEXTFIELD] Line 1 = "10/10/2012 - Date of Pay Stuff"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[TEXTFIELD] Line 2 = "Uncompleted"[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Codeblock:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]Dim MyCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If [TEXTFIELD] &amp;lt;&amp;gt; "Uncompleted" Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = Left ([TEXTFIELD],10)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End if&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]Line 1: 10/10/2012&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Line 2: &amp;gt; msg error &amp;lt;[/INDENT]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Oct 2012 10:15:11 GMT</pubDate>
    <dc:creator>LeandroNovaes</dc:creator>
    <dc:date>2012-10-31T10:15:11Z</dc:date>
    <item>
      <title>Suppressing msg error "wrong string value" or "maybe too large for the field"</title>
      <link>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691712#M39236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone, this is my first post here, but I am an enthusiast of ESRI Forums since Arcgis 3.x! :cool:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am doing some calculations with some shapefiles, but sometimes I am receiving the annoying message: [ATTACH=CONFIG]18833[/ATTACH], showing the error message "value may be too large for the field" or "trying to add a string to a number field".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, the destination field type is 'DATE' and I know that the results COULD BE COME in string. Because of that, I wrote an "else" in the codeblock (bellow) to avoid this kind of error, but isn't working!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]Dim MyCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If [DATEFIELD] &amp;lt;&amp;gt; "STRING TEXT" Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = [DATEFIELD]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End if[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone knows how to prevent this warning messages or can help to improve my simples codeblock to avoid that messages?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2012 12:00:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691712#M39236</guid>
      <dc:creator>LeandroNovaes</dc:creator>
      <dc:date>2012-10-30T12:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Suppressing msg error "wrong string value" or "maybe too large for the field"</title>
      <link>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691713#M39237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim MyCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If TypeOf [DATEFIELD] Is Not String Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = [DATEFIELD]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End if&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might need to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim MyCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If TypeOf [DATEFIELD].value Is Not String Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = [DATEFIELD]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End if&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2012 18:28:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691713#M39237</guid>
      <dc:creator>KevinDunlop</dc:creator>
      <dc:date>2012-10-30T18:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Suppressing msg error "wrong string value" or "maybe too large for the field"</title>
      <link>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691714#M39238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am sorry but this code won't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my particularly case, I have to transfer part of string field Left ([TEXTFIELD],10) to a date field type [DATEFIELD].&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;For example:&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT][TEXTFIELD] Line 1 = "10/10/2012 - Date of Pay Stuff"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[TEXTFIELD] Line 2 = "Uncompleted"[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Codeblock:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]Dim MyCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If [TEXTFIELD] &amp;lt;&amp;gt; "Uncompleted" Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = Left ([TEXTFIELD],10)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MyCode = null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End if&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]Line 1: 10/10/2012&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Line 2: &amp;gt; msg error &amp;lt;[/INDENT]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2012 10:15:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691714#M39238</guid>
      <dc:creator>LeandroNovaes</dc:creator>
      <dc:date>2012-10-31T10:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Suppressing msg error "wrong string value" or "maybe too large for the field"</title>
      <link>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691715#M39239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've run exactly the same code as you and get no error. Look at the screenshot:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]18878[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What ArcGIS wersion and which service pack are you using. I've seen some problems with 'null' in ArcGIS 10 pre-sp4 configurations.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Btw, you can try with Python code. Here's an example which works for me:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Codeblock:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def calDate(text):
&amp;nbsp; if text &amp;lt;&amp;gt; "Uncompleted":
&amp;nbsp;&amp;nbsp;&amp;nbsp; return text[:10]
&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; return None&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Datefield = &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Courier New;"&gt;calDate(!TEXTFIELD!)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:06:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/suppressing-msg-error-quot-wrong-string-value-quot/m-p/691715#M39239</guid>
      <dc:creator>MarcinGasior</dc:creator>
      <dc:date>2021-12-12T05:06:53Z</dc:date>
    </item>
  </channel>
</rss>

