<?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: Use Python expression in field calculator in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426831#M11523</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed this bug has still not been fixed.&amp;nbsp; Perhaps because it has 'VBA' as the programming language.&amp;nbsp; This bug effects any ArcObjects code, so maybe it should be set to .NET or C# ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Feb 2016 17:23:08 GMT</pubDate>
    <dc:creator>MarcBate</dc:creator>
    <dc:date>2016-02-23T17:23:08Z</dc:date>
    <item>
      <title>Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426826#M11518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I get an error when using a Python expression in the field calculator in ArcGIS 10 using ArcObjects.&amp;nbsp; The expression works fine when using the GUI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't see where to set the parser to Python instead of VBScript using ICalculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using .NET, but made this simple VBA routine for testing, where it updates the last field with the logp of the field named SumOfConcentrations&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

Public Sub TestPythonCalc()
 Dim fc As IFeatureClass
 Set fc = GetLayer0.FeatureClass
 
 Dim calc As ICalculator
 Set calc = New Calculator
 
 With calc
&amp;nbsp;&amp;nbsp; Set .Cursor = fc.Update(Nothing, False)
&amp;nbsp;&amp;nbsp; .Expression = "math.log1p(!SumOfConcentrations!)"
&amp;nbsp;&amp;nbsp; .Field = fc.Fields.Field(fc.Fields.FieldCount - 1).Name
&amp;nbsp;&amp;nbsp; .ShowErrorPrompt = False
&amp;nbsp;&amp;nbsp; .Calculate
 End With
 
End Sub

Private Function GetLayer0() As IGeoFeatureLayer

Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument

Dim pGFL As IGeoFeatureLayer
Set pGFL = pMxDoc.FocusMap.Layer(0)

Set GetLayer0 = pGFL
End Function
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 19:49:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426826#M11518</guid>
      <dc:creator>MarcBate</dc:creator>
      <dc:date>2010-08-24T19:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426827#M11519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a good question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 20:15:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426827#M11519</guid>
      <dc:creator>KirkKuykendall</dc:creator>
      <dc:date>2010-08-24T20:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426828#M11520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is a good question.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I searched through the Object Browser and couldn't find anything named python that sounded like it applied to the calculator.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Aug 2010 20:28:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426828#M11520</guid>
      <dc:creator>MarcBate</dc:creator>
      <dc:date>2010-08-24T20:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426829#M11521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This has been reported as a bug: NIM061356 (ICalculator or ICalculatorUI2 do not offer a property where the parser (expression type) can be specified; VBScript is the default, so Python expressions error out). Unfortunately, although being submitted over a year ago, it's classified as low priority and has not been fixed yet.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Oct 2011 20:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426829#M11521</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2011-10-31T20:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426830#M11522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It would be nice to put this in the ArcObjects help at least so others aren't pulling their hair out like I was trying to figure this out.&amp;nbsp;&amp;nbsp; I'm surprised no one else has ran into this issue as much as ESRI is promoting Python in the past year or so.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 21:32:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426830#M11522</guid>
      <dc:creator>MarcBate</dc:creator>
      <dc:date>2011-11-09T21:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426831#M11523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I noticed this bug has still not been fixed.&amp;nbsp; Perhaps because it has 'VBA' as the programming language.&amp;nbsp; This bug effects any ArcObjects code, so maybe it should be set to .NET or C# ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 17:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426831#M11523</guid>
      <dc:creator>MarcBate</dc:creator>
      <dc:date>2016-02-23T17:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Use Python expression in field calculator</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426832#M11524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usually, Esri support suggests that more people add their name to this issue so it will get a higher priority.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 18:32:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/use-python-expression-in-field-calculator/m-p/426832#M11524</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2016-02-23T18:32:40Z</dc:date>
    </item>
  </channel>
</rss>

