laptop and a wrench

漏洞

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.

上次发布: August 31, 2014 ArcGIS for Desktop
漏洞 ID 编号 NIM061356
已提交September 21, 2010
上次修改时间June 5, 2024
适用范围ArcGIS for Desktop
找到的版本10.0
编程语言VBA
操作系统Windows OS
操作系统版本7 64 Bit
状态Will Not Be Addressed

附加信息

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.

解决办法

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

重现步骤

漏洞 ID: NIM061356

软件:

  • ArcGIS for Desktop

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项