<?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: Python in Field Calculator in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173676#M13407</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you. We solved it with an extern python script and the FieldInfo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Feb 2014 06:32:09 GMT</pubDate>
    <dc:creator>MatthiasJessen</dc:creator>
    <dc:date>2014-02-03T06:32:09Z</dc:date>
    <item>
      <title>Python in Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173673#M13404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i try to use the index position of a field for an if-clause in the field calculator. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gesamt = &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;function(arcpy.fieldInfo.findFieldByName(!gesamt!))&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Codeblock:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def function(index):
 if (index &amp;gt; 30):
&amp;nbsp; ergebnis =&amp;nbsp; (!Join_Count! + !Join_Count_1!)
&amp;nbsp; return ergebnis
 else:
&amp;nbsp; return 99&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Result:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31051[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This way or syntax is probably totaly wrong and i am grateful for any advise or solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Feb 2014 08:39:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173673#M13404</guid>
      <dc:creator>MatthiasJessen</dc:creator>
      <dc:date>2014-02-02T08:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173674#M13405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The fieldInfo object is a property of a Describe object. Its class definition is in the arcpy package, but you don't use it from there (how does arcpy know what layer you are referring to?). See the 1st example in the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000004v000000"&gt;help&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.Describe(layer).fieldInfo.findFieldByName(!gesamt!))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Feb 2014 18:44:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173674#M13405</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2014-02-02T18:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173675#M13406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The fieldInfo object is a property of a Describe object. It's class definition is in the arcpy package, but you don't use it from there (how does arcpy know what layer you are referring to?). See the 1st example in the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000004v000000"&gt;help&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Try:&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.Describe(layer).fieldInfo.findFieldByName(!gesamt!))&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You also have to pass in the !Join_Count! and Join_Count_1! fields through the expression to the codeblock from the same layer.&amp;nbsp; A cursor pair might be easier if this is for a join table calculation with a runtime assigned layer set.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Try&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;function(arcpy.Describe(layer).fieldInfo.findFieldByName(!gesamt!), arcpy.Describe(layer).fieldInfo.findFieldByName(!Join_Count!), arcpy.Describe(layer).fieldInfo.findFieldByName(!Join_Count_1!)))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def function(index, Join_Count, Join_Count_1)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Feb 2014 18:50:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173675#M13406</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-02-02T18:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Field Calculator</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173676#M13407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you. We solved it with an extern python script and the FieldInfo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 06:32:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator/m-p/173676#M13407</guid>
      <dc:creator>MatthiasJessen</dc:creator>
      <dc:date>2014-02-03T06:32:09Z</dc:date>
    </item>
  </channel>
</rss>

