<?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: Using code block in field calculator in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576133#M45164</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all! Problem is resolved.&lt;/P&gt;&lt;P&gt;Apparently, since I was using a Join, I had to specify the table name in the expression. So no !W5! but !Database.W5!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Mar 2019 11:36:35 GMT</pubDate>
    <dc:creator>Thomvan_Oijen</dc:creator>
    <dc:date>2019-03-07T11:36:35Z</dc:date>
    <item>
      <title>Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576122#M45153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm completely at a lost here. I have tried all possible combinations and was trying to figure out how to get this to work but it just doesn't work for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The thing I am trying to accomplish is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 5 fields with a or b answers (1 or 0) and 5 fields with the correct solution. (also 1 or 0).&lt;/P&gt;&lt;P&gt;Q1-5 and A1-5.&lt;/P&gt;&lt;P&gt;I also have 5 fields with a Weight&lt;/P&gt;&lt;P&gt;W1-5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to find a floating value of 0-1 based on the answer. This goes in the field Betrouwbaarheid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I have so far, which is to you very clearly incorrect. But I have tried a lot of different types of formatting without avail.&lt;/P&gt;&lt;P&gt;Note: It's updated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Expression&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
calc&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!Q1!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Q2!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Q3!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Q4!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Q5!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !A1!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !A2!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !A3!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !A4!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !A5!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !W1!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !W2!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !W3!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !W4!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !W5&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

Code block&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;calc&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Q1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Q2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Q3&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Q4&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Q5&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; A1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; A2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; A3&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; A4&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; A5&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; W1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; W2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; W3&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; W4&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; W5&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Q1 &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; A1&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Q2 &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; A2&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;
    
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Q3 &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; A3&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;
        
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Q4 &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; A4&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c4 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c4 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;

    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Q5 &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; A5&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c5 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        c5 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;
    
    betr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;c1 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; W1 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; c2 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; W2 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; c3 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; W3 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; c4 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; W4 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; c5 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; W5&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;W1 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; W2 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; W3 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; W4 &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; W5&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; betr‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/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;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;/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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to the people below a part was resolved. My new code gives no syntax errors.&lt;/P&gt;&lt;P&gt;However, i still get an error when trying to do a field calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; ERROR 000539:   File "&amp;lt;expression&amp;gt;", line 1
    calc(, , , , , , , , , , , , , , )
         ^
SyntaxError: invalid syntax
 Failed to execute (CalculateField).&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope anyone can shed me some light into how this codeblock programming works. It's a complete and utter mystery to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:48:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576122#M45153</guid>
      <dc:creator>Thomvan_Oijen</dc:creator>
      <dc:date>2021-12-12T00:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576123#M45154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You haven't defined the Python variables Q1/A1/W1/Q2/A2/W2/Q3/A3/W3/Q4/A4/W4/Q5/A5/W5 (by adding them to parameter list?) and don't use Python syntax to reference the W? variables in the code block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression should look like&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;computeFn(!var1!,...!varN!)
‍‍&lt;SPAN class="line-numbers-rows"&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;&lt;/P&gt;&lt;P&gt;And the code block like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;computeFn&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;var1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;varN&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
     &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; var1 &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:48:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576123#M45154</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-12-12T00:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576124#M45155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting" target="_blank"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so line numbers can be referred to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code block shouldn't contain the field names in the exclamation marks.&amp;nbsp; They should reference variables.&lt;/P&gt;&lt;P&gt;The expression lines makes reference to those.&amp;nbsp; So the code block with a python parser goes in that section and the expression in its line.&amp;nbsp; In the example below&amp;nbsp; !Field1! is now linked to 'a' etc&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;fake_def&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;b&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"""fake function"""&lt;/SPAN&gt;
    d &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; a &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; b &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; c
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; d

&lt;SPAN class="comment token"&gt;# expression&lt;/SPAN&gt;

fake_def&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!Field1!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Field2!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; !Field3!&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:48:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576124#M45155</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T00:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576125#M45156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! You know this is not explained anywhere. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll update on a next post as it's not quite resolved yet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 15:05:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576125#M45156</guid>
      <dc:creator>Thomvan_Oijen</dc:creator>
      <dc:date>2019-03-04T15:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576126#M45157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to the people above I finally know how to properly use fields in the code block.&lt;/P&gt;&lt;P&gt;Unfortunately I still get an error message. This time it gives the following error:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; ERROR 000539:   File "&amp;lt;expression&amp;gt;", line 1
    calc(, , , , , , , , , , , , , , )
         ^
SyntaxError: invalid syntax
 Failed to execute (CalculateField).&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:48:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576126#M45157</guid>
      <dc:creator>Thomvan_Oijen</dc:creator>
      <dc:date>2021-12-12T00:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576127#M45158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you copy your function and your expression.&lt;/P&gt;&lt;P&gt;if your function was...&lt;/P&gt;&lt;P&gt;def calc(,,,,,,,,)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and your expression was&lt;/P&gt;&lt;P&gt;calc(,,,,,,)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will fail miserably since you didn't supply the field names to the expression, nor did you provide variable names to the function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 15:26:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576127#M45158</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-03-04T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576128#M45159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks dan, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The used expression and code is in my opening post. I updated it.&lt;/P&gt;&lt;P&gt;It has the same amount of variabels in the code as I have fields in the expression. (so same amount of ,)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 15:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576128#M45159</guid>
      <dc:creator>Thomvan_Oijen</dc:creator>
      <dc:date>2019-03-04T15:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576129#M45160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;!W5! &amp;nbsp; you have !W5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 16:23:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576129#M45160</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-03-04T16:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576130#M45161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Going back and editing the initial post is required in GIS SE, but it's confusing here, where there is no way to distinguish comments&amp;nbsp; from answers.&amp;nbsp; Far better to post edited code as a reply to the original post, so that your current code is provided as a snapshot in time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 20:50:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576130#M45161</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2019-03-04T20:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576131#M45162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are all your weight fields&amp;nbsp;(your Ws) stored using&amp;nbsp;numeric data types?&amp;nbsp;&amp;nbsp;If any (or all) of your weight fields is (are) defined as text strings, then trying to multiply by a string will cause the calculation to fail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2019 22:40:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576131#M45162</guid>
      <dc:creator>ScottDrzyzga</dc:creator>
      <dc:date>2019-03-04T22:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576132#M45163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott, it never got past the first line since a trailing ! was missing... see my previous post&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2019 12:29:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576132#M45163</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-03-06T12:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using code block in field calculator</title>
      <link>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576133#M45164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all! Problem is resolved.&lt;/P&gt;&lt;P&gt;Apparently, since I was using a Join, I had to specify the table name in the expression. So no !W5! but !Database.W5!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2019 11:36:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-code-block-in-field-calculator/m-p/576133#M45164</guid>
      <dc:creator>Thomvan_Oijen</dc:creator>
      <dc:date>2019-03-07T11:36:35Z</dc:date>
    </item>
  </channel>
</rss>

