Skip to main content

ParseFieldName

汇总

将全限定字段名解析为依赖工作空间的各个组成部分(数据库名称、所有者名称、表名和字段名)。 ParseFieldName 将返回一个包含已解析表名的字符串,其中包含数据库名称、所有者名称、表名和字段名称(以逗号分隔)。 此工作空间必须是文件地理数据库或企业级地理数据库。

语法

ParseFieldName(name, {workspace})

参数 说明 数据类型

name

The field name to be parsed.

String

workspace

Specifies the workspace for fully qualifying the field name. The workspace must be a file, or enterprise geodatabase.

String

返回值

数据类型 说明

String

返回已解析为由逗号分隔各个组成部分(数据库名称、所有者名称、表名、字段名)的字段名。

代码示例

ParseFieldName 示例

将字段名解析为各个组成部分。

import arcpy

field_name = arcpy.GetParameterAsText(0)
workspace = arcpy.GetParameterAsText(1)

# Parse the field name into database, owner, table and field
fullname = arcpy.ParseFieldName(field_name, workspace)
database, owner, table, field = fullname.split(", ")