<?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 fix a parcing error for field calculator? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743427#M57461</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If by "put 3 fields together" you mean concatenate three fields with mixed data types, and possibly having NULL values, then try the following in the expression dialog box:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!CSubdivision!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !CBlock!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !CLot!&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Dec 2016 00:23:42 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2016-12-20T00:23:42Z</dc:date>
    <item>
      <title>How to fix a parcing error for field calculator?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743425#M57459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to put 3 fields together with no spaces and some of them are null. I tried the following expression: !AssetID!.replace("zero", str(!CSubdivision! + !CBlock! + !CLot! ))&lt;/P&gt;&lt;P&gt;If any of the fields are null, then the AssetID field also ends up null. I am trying to find a way around this and this is what I've come up with so far. I get keep getting a parcing error and I don't understand why. Can I return an expression? If not, how would I go about getting rid of the null values without changing my data?&lt;/P&gt;&lt;P&gt;(I'm using 10.4)&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/286707_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2016 20:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743425#M57459</guid>
      <dc:creator>HannahDodd</dc:creator>
      <dc:date>2016-12-19T20:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a parcing error for field calculator?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743426#M57460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can jump through hoops trying to get every incarnation to work, or&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;fix the inputs so that you use a 'null value' that is recognized such as "nodata" as a string for text fields or -99999 or some ridiculous number that isn't possible for your numeric fields.&lt;/P&gt;&lt;P&gt;Then concatenation is easy.&lt;/P&gt;&lt;P&gt;In your case, I would query for the condition were all three fields, individually Is NOT Null, then do the field concatenation in the field calculator.&lt;/P&gt;&lt;P&gt;if any of the fields are numeric, they need to be converted to string first ie.&lt;/P&gt;&lt;P&gt;str(!fieldA!) + str(!fieldB!)+str(!fieldC! &amp;nbsp; or learn the new formatting language... it does the conversion and concatenation for you&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;"{}{}{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"be"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"with the universe"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:38:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743426#M57460</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T07:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a parcing error for field calculator?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743427#M57461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If by "put 3 fields together" you mean concatenate three fields with mixed data types, and possibly having NULL values, then try the following in the expression dialog box:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!CSubdivision!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !CBlock!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !CLot!&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2016 00:23:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-fix-a-parcing-error-for-field-calculator/m-p/743427#M57461</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-12-20T00:23:42Z</dc:date>
    </item>
  </channel>
</rss>

