<?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: Field Calculator to (2 Fields) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556153#M43464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try the above steps in VB script parser? Is it still throwing error message?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Sep 2016 05:44:17 GMT</pubDate>
    <dc:creator>JayantaPoddar</dc:creator>
    <dc:date>2016-09-06T05:44:17Z</dc:date>
    <item>
      <title>Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556150#M43461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HELP ME! PLEASE!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim n&lt;BR /&gt;if ([CATEGORIA_IPD] = 'MEDIA') And ([IVR]= 'PARCIALMENTE TRANSFORMADO') Then&lt;BR /&gt;n = 20&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="220871" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/220871_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="220864" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/220864_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 04:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556150#M43461</guid>
      <dc:creator>CarlosHernandez8</dc:creator>
      <dc:date>2016-09-06T04:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556151#M43462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, you are using VB Script parser, not Python (you have shared in Python space).&lt;/P&gt;&lt;P&gt;Try Replacing &lt;STRONG&gt;And&lt;/STRONG&gt; with &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;If that doesn't solve the issue, also replace &lt;STRONG&gt;20&lt;/STRONG&gt; with &lt;STRONG&gt;"20"&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 05:15:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556151#M43462</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2016-09-06T05:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556152#M43463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to do with Python?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 05:36:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556152#M43463</guid>
      <dc:creator>CarlosHernandez8</dc:creator>
      <dc:date>2016-09-06T05:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556153#M43464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try the above steps in VB script parser? Is it still throwing error message?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 05:44:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556153#M43464</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2016-09-06T05:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556154#M43465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it is not a mandate to do everything in Field Calculaor, you could also &lt;STRONG&gt;Select by Attributes.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;[CATEGORIA_IPD] = 'MEDIA' AND [IVR]= 'PARCIALMENTE TRANSFORMADO'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Once the records are selected, you could open Field Calculator for &lt;STRONG&gt;R_1&lt;/STRONG&gt; and define 20 as the value.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 05:55:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556154#M43465</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2016-09-06T05:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556155#M43466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have not assigned a value to a field.&amp;nbsp; Is 'n' your new field?&lt;/P&gt;&lt;P&gt;syntactically it should be&lt;/P&gt;&lt;P&gt;python parser! NOT VB&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;def calculate(field1, field2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (field1 = 'MEDIA') and (field2 = 'PARCIALMENTE TRANSFORMADO'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = 20&amp;nbsp; # or '20'
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = ?????&amp;nbsp; # what do you want? "" or something else
&amp;nbsp;&amp;nbsp;&amp;nbsp; return n‍‍‍‍‍

Expression box
def calculate(!CATEGORIA_IPD!, !IVR!)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;you have to provide an option for the case where they are not equal to your queries.&amp;nbsp; Move on to python.&amp;nbsp; The function is the first 6 lines, and what goes into the expression box is line 9&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:01:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556155#M43466</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T00:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator to (2 Fields)</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556156#M43467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only thing completely wrong in your original example is that VBScript uses double quotes for strings, not single quotes (Python uses either). You also don't need to 'dim' in VBScript, that's a VBA thing. You will also get a warning if the function returns nothing, but you can click&amp;nbsp;past that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Nov 2016 22:11:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-to-2-fields/m-p/556156#M43467</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-11-10T22:11:48Z</dc:date>
    </item>
  </channel>
</rss>

