laptop and a wrench

Bug

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.

Zuletzt veröffentlicht: August 31, 2014 ArcGIS for Desktop
Bug-ID-Nummer NIM061356
EingereichtSeptember 21, 2010
Zuletzt geändertJune 5, 2024
Gilt fürArcGIS for Desktop
Gefunden in Version10.0
ProgrammspracheVBA
BetriebssystemWindows OS
Betriebssystemversion7 64 Bit
StatusWill Not Be Addressed

Zusätzliche Informationen

We apologize that we were unable to address this issue within the current product support cycle. If the issue continues to affect your work in a supported release, please contact Technical Support.

Workaround

Below is a workaround that compensates for the lack of being able to specify the parser in ICalculator. It takes advantage of IGeoProcessor and the CalculateField_management geoprocessing tool. The parser or expression_type argument of that tool can be used to specify Python as the parser.'(To test the below VBA code, create a UIButton in VBA and add the code inside the Click event handler of your new UIButton. The second procedure, ReturnMessages(), is called into action by the first procedure towards the very end, but may not be necessary if you do not want to read the messages of the geoprocessing results. Change the first parameter as needed to reflect the correct location of your input table.)Private Sub UIButtonControl1_Click() 'Create the Geoprocessor Dim pGp As IGeoProcessor Set pGp = New GeoProcessor 'Set Overwriteoutput to True pGp.OverwriteOutput = True 'Add the custom toolbox containing the model tool 'pGp.AddToolbox "C:\CustomTools\custom.tbx" 'Create the Parameter array Dim pParamArray As IVariantArray Set pParamArray = New VarArray 'Populate array of parameters 'First Parameter: in_table (e.g. File GDB feature class) pParamArray.Add "C:\Incidents\845875\Converted_GDB931\downgradedFGDB.gdb\Main_931" 'Second Parameter: field on which to calculate pParamArray.Add "LastField" 'Third Parameter: expression pParamArray.Add "math.log1p(!SumOfConcentrations!)" 'Fourth Parameter: expression_type (Optional) !!! !!! !!! !!! !!! pParamArray.Add "PYTHON_9.3" Dim pResult As IGeoProcessorResult 'Execute the Model tool Set pResult = pGp.Execute("CalculateField_management", pParamArray, Nothing) 'Get the returned tool messages ReturnMessages pResultEnd SubPublic Sub ReturnMessages(ByVal messages As IGeoProcessorResult) Dim i As Long Dim message As String For i = 0 To messages.MessageCount - 1 message = messages.GetMessage(i) Debug.Print message NextEnd Sub

Schritte zur Reproduzierung

Bug-ID: NIM061356

Software:

  • ArcGIS for Desktop

Benachrichtigung erhalten, wenn sich der Status eines Bugs ändert

Esri Support App herunterladen

Weitere Informationen zu diesem Thema erkunden

Unterstützung durch ArcGIS-Experten anfordern

An den technischen Support wenden

Esri Support App herunterladen

Zu Download-Optionen wechseln