Frequently asked question
Network dataset Field Script and Element Script evaluators using VBScript have been deprecated for several releases of ArcGIS Pro, and support for VBScript-based evaluators will be removed in the ArcGIS Pro 3.5 release. This article explains what still works and what does not work starting in ArcGIS Pro 3.5 and how to update VBScript-based evaluators to Python.
Each network dataset attribute, such as a cost attribute or restriction, is configured with evaluators, which tell the network how to calculate a value for the attribute for each network edge, junction, or turn. For example, an evaluator for a cost attribute performs some calculation to determine how much it costs (usually in time or distance) to travel down a specific street.
The Field Script evaluator performs this calculation by checking the value of one or more fields in a network dataset source feature class. The Element Script evaluator performs this calculation based on user code that can reference other network attributes, parameters, and properties.
Historically, both Field Script and Element Script evaluators could be written in either VBScript or Python. Starting with the ArcGIS Pro 3.4 release, it is no longer possible to edit VBScript-based evaluators and must be changed to Python before making any changes. Starting in the ArcGIS Pro 3.5 release, certain functionalities will no longer work for network datasets with evaluators coded in VBScript.
Starting from ArcGIS Pro 3.5, the following functionalities cease to work:
Because it will no longer be possible to build a network dataset that has VBScript-based evaluators, it will not be possible to make any edits to the network dataset properties or source feature classes that trigger the need for a network rebuild without also updating the evaluators.
Solving a network analysis using a network with VBScript-based Field Script evaluators will continue to work, so these networks can still be used as long as they do not require any edits.
To retain the full network dataset functionality throughout the new releases of ArcGIS Pro, the VBScript-based Field Script and Element Script evaluators must be updated to use Python. Attributes configured with VBScript evaluators display warning messages in the network dataset property pages as shown in the image sample below.
Note: Some attributes may display other, unrelated warning messages.
The main difference between coding in VBScript and Python is that fields in VBScript are bracketed in square brackets, while in Python they are bracketed with exclamation points. To visualize this, the field MINUTES will be used to provide an example below:
In VBScript, the fields are coded in square brackets.
[MINUTES]
In Python, the fields are coded in exclamation points.
!MINUTES!
As many Field Script evaluators reference a single field in the source feature class, updating the expressions from VBScript to Python will mainly require replacing the square brackets with exclamation points. More complex VBScript code will require a more substantial code translation. To change the code from VBScript to Python, proceed with the following steps:
Note: When the Field Script Evaluator Properties dialog box is opened, a warning message is displayed and the code boxes are locked, rendering them unenditable, as shown in the image below.
The image below shows the evaluator configuration for the edges source of the attribute updated.
The workflow to update VBScript-based Element Script evaluators is similar to the Field Script evaluator workflow detailed above. However, the coding in Element Script evaluators is not as straightforward as coding in Field Script evaluators, as the coding is specific to the type of element used as well as the user’s unique application. Hence, there is no consistent formula to convert the VBScript coding to a Python coding, and the user must fully understand the original coding and rewrite it to fit the Python syntax. However, the AttributeValueByName() and ParameterValueByName() helper methods are coded the same in both languages, so these do not need to be updated. Refer to ArcGIS Pro: Element Script evaluator examples for more information.
Article ID: 000034321
Get help from ArcGIS experts
Download the Esri Support App