This tool can also be used to update character items. To calculate strings to text or character fields, in the dialog box the string must use double quotation marks ("string"), or in scripting, the string using double quotation marks must also be encapsulated in single quotation marks ('"string"'). The calculation can only be applied to one field per operation.įields are always enclosed in brackets for VBScript.įor Python calculations, field names must be enclosed in exclamation points ( !fieldname!). When used with a selected set of features, such as those created from a query in Make Feature Layer or Select Layer By Attribute, this tool will only update the selected records.
Tips and best practices for using the Calculate Field toolĬalculates the values of a field for a feature class, feature layer, or raster.Įxpressions can be created using VBScript or a standard Python format. The following includes a number of important tips and best practices for using the Calculate Field tool. The syntax that must be used in a calculation expression differs depending on the data source and scripting language. When performing field calculations, it is important to know what type of data you are using and in what context it is going to be used in the future. This is the same tool that is opened when you click the Field Calculator command from the field context menu of an attribute table. The Calculate Field tool is located in the Data Management toolbox in the Fields toolset.